Skip to content

Commit

Permalink
Force normal always face ray origin
Browse files Browse the repository at this point in the history
  • Loading branch information
sultim-t committed Sep 23, 2023
1 parent cd236cc commit 6f82603
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Source/Shaders/HitInfo.inl
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,12 @@ ShHitInfo getHitInfoBounce(
{
h.normal = safeNormalize(
cross( tr.positions[ 1 ] - tr.positions[ 0 ], tr.positions[ 2 ] - tr.positions[ 0 ] ) );
}

// always face ray origin
if( dot( h.normal, h.hitPosition - rayOrigin ) > 0 )
{
h.normal *= -1;
}
// always face ray origin
if( dot( h.normal, h.hitPosition - rayOrigin ) > 0 )
{
h.normal *= -1;
}


Expand Down

0 comments on commit 6f82603

Please sign in to comment.