Skip to content

Commit

Permalink
Sanitize unreliable interpolated normals, produced by a game -- if th…
Browse files Browse the repository at this point in the history
…e perfect reflection over the interpolated normal would point into the surface: correct the normal, so the reflected direction points mostly coplanar to a normal plane. This fixes POM, where it was more pronounced.
  • Loading branch information
sultim-t-nv committed Feb 28, 2024
1 parent d1e34a1 commit 0d2a38e
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ SurfaceInteraction surfaceInteractionCreate(
// Really the only reason to flip this normal is for double-sided geometry. Do not flip based on view vector!
const bool interpolatedNormalSameDirection = dot(interpolatedNormal, flippedTriangleNormal) >= float16_t(0.0);
const f16vec3 flippedInterpolatedNormal = interpolatedNormalSameDirection ? interpolatedNormal : -interpolatedNormal;
surfaceInteraction.interpolatedNormal = flippedInterpolatedNormal;

surfaceInteraction.interpolatedNormal = getBentNormal(surfaceInteraction.triangleNormal, flippedInterpolatedNormal, ray.direction);
}

// Compute motion
Expand Down

0 comments on commit 0d2a38e

Please sign in to comment.