Skip to content

Commit 855c738

Browse files
authored
[7.x.x Backport] Fixed division by zero in visibility function (#1748)
* Backport of #346 * Updating a shadergraph shader in URP Test project. Adding to the manifest in ShaderGraph project[Skip CI]
1 parent 18664fa commit 855c738

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

com.unity.render-pipelines.core/ShaderLibrary/BSDF.hlsl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ real V_SmithJointGGX(real NdotL, real NdotV, real roughness, real partLambdaV)
223223
real lambdaL = NdotV * sqrt((-NdotL * a2 + NdotL) * NdotL + a2);
224224

225225
// Simplify visibility term: (2.0 * NdotL * NdotV) / ((4.0 * NdotL * NdotV) * (lambda_v + lambda_l))
226-
return 0.5 / (lambdaV + lambdaL);
226+
return 0.5 / max(lambdaV + lambdaL, REAL_MIN);
227227
}
228228

229229
real V_SmithJointGGX(real NdotL, real NdotV, real roughness)

com.unity.render-pipelines.universal/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2626
- Fixed an issue that caused a warning to be thrown about temporary render texture not found when user calls ConfigureTarget(0). [case 1220871](https://issuetracker.unity3d.com/issues/urp-scriptable-render-passes-which-dont-require-a-bound-render-target-triggers-render-target-warning)
2727
- Fixed issue that caused some properties in the camera to not be bold and highlighted when edited in prefab mode. [case 1230082](https://issuetracker.unity3d.com/issues/urp-camera-prefab-fields-render-type-renderer-background-type-are-not-bolded-and-highlighted-when-edited-in-prefab-mode)
2828
- Fixed an issue that impacted MSAA performance on iOS/Metal [case 1219054](https://issuetracker.unity3d.com/issues/urp-ios-msaa-has-a-bigger-negative-impact-on-performance-when-using-urp-compared-to-built-in-rp)
29+
- Fixed division by zero in `V_SmithJointGGX` function.
2930

3031
## [7.4.1] - 2020-06-03
3132

0 commit comments

Comments
 (0)