O'Reilly logo

Physically Based Rendering, 3rd Edition by Greg Humphreys, Wenzel Jakob, Matt Pharr

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Now we certainly have a valid intersection and can update the values pointed to by the pointers passed to the intersection routine. Unlike other shapes’ implementations, the code that initializes the SurfaceInteraction structure here doesn’t need to transform the partial derivatives to world space, since the triangle’s vertices were already transformed to world space. Like the disk, the partial derivatives of the triangle’s normal are also both (0, 0, 0), since it is flat.

Fill in SurfaceInteraction from triangle hit〉 ≡  157

  *isect = SurfaceInteraction(pHit, pError, uvHit, -ray.d, dpdu, dpdv,

    Normal3f(0, 0, 0), Normal3f(0, 0, 0), ray.time, this);

  〈Override surface normal in isect for triangle 165

  if (mesh-> n || mesh-> s) {

    〈 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required