From 8fc7c1ccf05e3bac32fec1e10654de2fb3c8b1b1 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 deb9311e71e..221c82e3c99 100644 --- a/com.unity.render-pipelines.high-definition/CHANGELOG.md +++ b/com.unity.render-pipelines.high-definition/CHANGELOG.md @@ -33,6 +33,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Fix for issue that prevented scene from being completely saved when baked reflection probes are present and lighting is set to auto generate. - Fixed the depth buffer copy made before custom pass after opaque and normal injection point. - 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 - Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history. 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 d4dcfc77194..7da9be1d3ed 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 @@ -1710,7 +1710,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 80c9e078dc7fb7358f5f5bb143109565909cc83e Mon Sep 17 00:00:00 2001 From: Anis Date: Mon, 6 Apr 2020 18:41:13 +0200 Subject: [PATCH 2/2] update ssr screenshot --- .../Linear/WindowsEditor/Direct3D11/2551_SSR.png | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2551_SSR.png b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2551_SSR.png index 76b6f8cc094..11d290bcef7 100644 --- a/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2551_SSR.png +++ b/TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11/2551_SSR.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f1ce98030ef6df4810de3d39dbb963c8b53137597ba47f47fb628c51dbf89ea9 -size 147472 +oid sha256:235f591a18ba1f53e0144f5996fcfb91b3a2704ae65459618ece20bafcffd284 +size 146936