From af57211ff35fe2881d98559f4d9b423bb439fa60 Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 6 Apr 2020 17:15:43 +0200 Subject: [PATCH 1/2] Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader). --- com.unity.render-pipelines.high-definition/CHANGELOG.md | 1 + .../Runtime/Material/Lit/Lit.hlsl | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/com.unity.render-pipelines.high-definition/CHANGELOG.md b/com.unity.render-pipelines.high-definition/CHANGELOG.md index 55481e24e24..ff6a1351a6b 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -511,6 +511,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix issues in the post process system with RenderTexture being invalid in some cases, causing rendering problems. - Fixed an issue where unncessarily serialized members in StaticLightingSky component would change each time the scene is changed. - Fixed a weird behavior in the scalable settings drawing when the space becomes tiny (1212045). +- Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader). ### Changed - Color buffer pyramid is not allocated anymore if neither refraction nor distortion are enabled diff --git a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl index 74e704ede68..57e71d1537e 100644 --- a/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl +++ b/com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl @@ -1728,7 +1728,12 @@ IndirectLighting EvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput, ApplyScreenSpaceReflectionWeight(ssrLighting); // TODO: we should multiply all indirect lighting by the FGD value only ONCE. - lighting.specularReflected = ssrLighting.rgb * preLightData.specularFGD; + // In case this material has a clear coat, we shou not be using the specularFGD. The condition for it is a combination + // of a materia feature and the coat mask. + float clampedNdotV = ClampNdotV(preLightData.NdotV); + lighting.specularReflected = ssrLighting.rgb * (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT) ? + lerp(preLightData.specularFGD, F_Schlick(CLEAR_COAT_F0, clampedNdotV), bsdfData.coatMask) + : preLightData.specularFGD); reflectionHierarchyWeight = ssrLighting.a; return lighting; From 2398ea73518f554f7dab8f40b8dec796c42678eb Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 6 Apr 2020 18:17:42 +0200 Subject: [PATCH 2/2] update ssr screenshot --- .../Linear/WindowsEditor/Direct3D11/None/2551_SSR.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2551_SSR.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2551_SSR.png index 5072855f828..11d290bcef7 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2551_SSR.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/None/2551_SSR.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8683fa5746afb3e8639585cc601c1911884aa5cbdcea098428c36872a2046640 -size 147475 +oid sha256:235f591a18ba1f53e0144f5996fcfb91b3a2704ae65459618ece20bafcffd284 +size 146936