Skip to content

Commit

Permalink
Fix bug in NormalMap()
Browse files Browse the repository at this point in the history
When computing the local basis, it's important to keep the +x axis
consistently oriented with dpdu.

Fixes #381.
  • Loading branch information
mmp committed Sep 17, 2023
1 parent 425faa0 commit 83e4599
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/pbrt/materials.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ inline PBRT_CPU_GPU void NormalMap(const Image &normalMap,
ns = Normalize(ns);

// Transform tangent-space normal to rendering space
Frame frame = Frame::FromZ(ctx.shading.n);
Frame frame = Frame::FromXZ(Normalize(ctx.shading.dpdu), Vector3f(ctx.shading.n));
ns = frame.FromLocal(ns);

// Find $\dpdu$ and $\dpdv$ that give shading normal
Expand Down

0 comments on commit 83e4599

Please sign in to comment.