Skip to content

Commit 9993a1c

Browse files
[7.x.x Backport] Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader). (#21)
* Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader). * update ssr screenshot Co-authored-by: sebastienlagarde <[email protected]>
1 parent 359afb4 commit 9993a1c

File tree

3 files changed

+9
-3
lines changed
  • TestProjects/HDRP_Tests/Assets/ReferenceImages/Linear/WindowsEditor/Direct3D11
  • com.unity.render-pipelines.high-definition

3 files changed

+9
-3
lines changed
Lines changed: 2 additions & 2 deletions
Loading

com.unity.render-pipelines.high-definition/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4141
- Fixed path validation when creating new volume profile (case 1229933)
4242
- Fixed various object leaks in HDRP.
4343
- Fix for assertion triggering sometimes when saving a newly created lit shader graph (case 1230996)
44+
- Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader).
4445

4546
### Changed
4647
- Rejecting history for ray traced reflections based on a threshold evaluated on the neighborhood of the sampled history.

com.unity.render-pipelines.high-definition/Runtime/Material/Lit/Lit.hlsl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,12 @@ IndirectLighting EvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput,
17101710
ApplyScreenSpaceReflectionWeight(ssrLighting);
17111711

17121712
// TODO: we should multiply all indirect lighting by the FGD value only ONCE.
1713-
lighting.specularReflected = ssrLighting.rgb * preLightData.specularFGD;
1713+
// In case this material has a clear coat, we shou not be using the specularFGD. The condition for it is a combination
1714+
// of a materia feature and the coat mask.
1715+
float clampedNdotV = ClampNdotV(preLightData.NdotV);
1716+
lighting.specularReflected = ssrLighting.rgb * (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT) ?
1717+
lerp(preLightData.specularFGD, F_Schlick(CLEAR_COAT_F0, clampedNdotV), bsdfData.coatMask)
1718+
: preLightData.specularFGD);
17141719
reflectionHierarchyWeight = ssrLighting.a;
17151720

17161721
return lighting;

0 commit comments

Comments
 (0)