Skip to content

Commit

Permalink
Document why we normalize the normal
Browse files Browse the repository at this point in the history
  • Loading branch information
darksylinc committed Dec 31, 2024
1 parent 259f355 commit 7a4b336
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Samples/Media/Hlms/Pbs/Any/Main/800.VertexShader_piece_vs.any
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
@end

@property( hlms_normal || hlms_qtangent )
// Must be normalized for offset bias to work correctly.
worldNorm = normalize( worldNorm );
@end

Expand Down Expand Up @@ -301,6 +302,7 @@
const midf3x3 normalAdjMat = adjugateForNormalsFrom4x3( worldMat );

// We need worldNorm for normal offset bias.
// Must be normalized for offset bias to work correctly.
midf3 worldNorm = normalize( mul( inputNormal, normalAdjMat ).xyz );
@end
@end
Expand All @@ -311,6 +313,7 @@
const midf3x3 normalAdjMat = adjugateForNormalsFrom4x3( worldMat );

// We need worldNorm for normal offset bias, special path when using poses.
// Must be normalized for offset bias to work correctly.
midf3 worldNorm = normalize( mul( inputNormal, normalAdjMat ).xyz );
@end

Expand Down

0 comments on commit 7a4b336

Please sign in to comment.