3.6.2: Triangle intersection

The structure of the triangle shape’s Intersect() method follows the form of earlier intersection test methods: a geometric test is applied to determine if there is an intersection and, if so, further information is computed about the intersection to return in the given SurfaceInteraction.

Triangle Method Definitions〉 + ≡ bool Triangle::Intersect(const Ray &ray, Float *tHit,   SurfaceInteraction *isect, bool testAlphaTexture) const {

        Get triangle vertices in p0, p1, and p2 157

        Perform ray-triangle intersection test 158

        Compute triangle partial derivatives 164

        Compute error bounds for triangle intersection 227

        Interpolate (u, v) parametric coordinates and hit point 164

         ...

Get Physically Based Rendering, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.