Skip to content

Commit af57211

Browse files
committed
Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader).
1 parent 6287617 commit af57211

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
511511
- Fix issues in the post process system with RenderTexture being invalid in some cases, causing rendering problems.
512512
- Fixed an issue where unncessarily serialized members in StaticLightingSky component would change each time the scene is changed.
513513
- Fixed a weird behavior in the scalable settings drawing when the space becomes tiny (1212045).
514+
- Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader).
514515

515516
### Changed
516517
- Color buffer pyramid is not allocated anymore if neither refraction nor distortion are enabled

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
@@ -1728,7 +1728,12 @@ IndirectLighting EvaluateBSDF_ScreenSpaceReflection(PositionInputs posInput,
17281728
ApplyScreenSpaceReflectionWeight(ssrLighting);
17291729

17301730
// TODO: we should multiply all indirect lighting by the FGD value only ONCE.
1731-
lighting.specularReflected = ssrLighting.rgb * preLightData.specularFGD;
1731+
// In case this material has a clear coat, we shou not be using the specularFGD. The condition for it is a combination
1732+
// of a materia feature and the coat mask.
1733+
float clampedNdotV = ClampNdotV(preLightData.NdotV);
1734+
lighting.specularReflected = ssrLighting.rgb * (HasFlag(bsdfData.materialFeatures, MATERIALFEATUREFLAGS_LIT_CLEAR_COAT) ?
1735+
lerp(preLightData.specularFGD, F_Schlick(CLEAR_COAT_F0, clampedNdotV), bsdfData.coatMask)
1736+
: preLightData.specularFGD);
17321737
reflectionHierarchyWeight = ssrLighting.a;
17331738

17341739
return lighting;

0 commit comments

Comments
 (0)