Skip to content

Fix a Divide-by-Zero Warning for some Anisotropic Models (Fabric, Lit) #4636

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
May 29, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
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 @@ -217,6 +217,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed a compilation issue for AxF carpaints on Vulkan (case 1314040).
- Fixed the ray traced sub subsurface scattering debug mode not displaying only the RTSSS Data (case 1332904).
- Fixed for discrepancies in intensity and saturation between screen space refraction and probe refraction.
- Fixed a divide-by-zero warning for anisotropic shaders (Fabric, Lit).

### Changed
- Changed Window/Render Pipeline/HD Render Pipeline Wizard to Window/Rendering/HDRP Wizard
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ void BuildSurfaceData(FragInputs fragInputs, inout SurfaceDescription surfaceDes
#ifdef _MATERIAL_FEATURE_COTTON_WOOL
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_FABRIC_COTTON_WOOL;
$SurfaceDescription.Smoothness: surfaceData.perceptualSmoothness = lerp(0.0, 0.6, surfaceDescription.Smoothness);
#else
// Initialize the normal to something non-zero to avoid div-zero warnings for anisotropy.
surfaceData.normalWS = float3(0, 1, 0);
#endif

#ifdef _MATERIAL_FEATURE_SUBSURFACE_SCATTERING
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ void BuildSurfaceData(FragInputs fragInputs, inout SurfaceDescription surfaceDes

#ifdef _MATERIAL_FEATURE_ANISOTROPY
surfaceData.materialFeatures |= MATERIALFEATUREFLAGS_LIT_ANISOTROPY;

// Initialize the normal to something non-zero to avoid a div-zero warning for anisotropy.
surfaceData.normalWS = float3(0, 1, 0);
#endif

#ifdef _MATERIAL_FEATURE_IRIDESCENCE
Expand Down