Skip to content

Commit

Permalink
Fixed SafeNormalize to correctly work with half (Unity-Technologies#3590
Browse files Browse the repository at this point in the history
)

* Changing to real. As in case of half it returning float for real which resulted in 0

* Adding changelog entry
  • Loading branch information
lukaschod authored Mar 1, 2021
1 parent 8ea8bb7 commit af4a33d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion com.unity.render-pipelines.core/ShaderLibrary/Common.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -1225,7 +1225,7 @@ bool HasFlag(uint bitfield, uint flag)
// Normalize that account for vectors with zero length
real3 SafeNormalize(float3 inVec)
{
real dp3 = max(FLT_MIN, dot(inVec, inVec));
real dp3 = max(REAL_MIN, dot(inVec, inVec));
return inVec * rsqrt(dp3);
}

Expand Down
1 change: 1 addition & 0 deletions com.unity.render-pipelines.universal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Fixed shadowCoord error when main light shadow defined in unlit shader graph [case 1175274](https://issuetracker.unity3d.com/issues/shadows-not-applying-when-using-file-in-a-custom-function-node-with-universal-rp)
- Removed Custom.meta which was causing warnings. [case 1314288](https://issuetracker.unity3d.com/issues/urp-warnings-about-missing-metadata-appear-after-installing)
- Fixed a case where shadow fade was clipped too early.
- Fixed SafeNormalize returning invalid vector when using half with zero length. [case 1315956]
- Fixed lit shader property duplication issue. [case 1315032](https://issuetracker.unity3d.com/issues/shader-dot-propertytoid-returns-the-same-id-when-shaders-properties-have-the-same-name-but-different-type)
- Fixed undo issues for the additional light property on the UniversalRenderPipeline Asset. [case 1300367]
- Fixed an issue where SSAO would sometimes not render with a recently imported renderer.
Expand Down

0 comments on commit af4a33d

Please sign in to comment.