Skip to content

[8.x.x Backport] Fixed an issue with the specularFGD term being used when the material has a clear coat (lit shader). #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions com.unity.render-pipelines.high-definition/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,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
- Renamed the cubemap used for diffuse convolution to a more explicit name for the memory profiler.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down