Skip to content

Commit 23adeb0

Browse files
fix uv derivatives
1 parent 1dce64f commit 23adeb0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/testrender/raytracer.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -322,16 +322,16 @@ struct Scene {
322322
// TODO: smooth out dPdu and dPdv by storing per vertex tangents
323323
}
324324

325-
// L represent planes constructed from opposite points
326-
// scaled to return 1.0 for scalar product with itself
327-
Vec3 La = vb.cross(vc);
328-
La /= dot(va, La);
325+
// L represent planes constructed from opposite points perpendicular
326+
// to N and scaled to return 1.0 for scalar product with itself
327+
Vec3 La = n.cross(vc - vb);
328+
La /= dot(va - vb, La);
329329

330-
Vec3 Lb = va.cross(vc);
331-
Lb /= dot(vb, Lb);
330+
Vec3 Lb = n.cross(va - vc);
331+
Lb /= dot(vb - vc, Lb);
332332

333-
Vec3 Lc = va.cross(vb);
334-
Lc /= dot(vc, Lc);
333+
Vec3 Lc = n.cross(vb - va);
334+
Lc /= dot(vc - va, Lc);
335335

336336
Vec2 dTdx = dot(La, p.dx()) * ta +
337337
dot(Lb, p.dx()) * tb +

0 commit comments

Comments
 (0)