Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
I want to know the nearest face that the ray intersected for each pixel in the image. I want to write it out to a file. I know there is a faceIndex variable that contain this information in the SurfaceIntersection object. However when I tried I always found that it containts a default value of 0 for each pixel. Is there any way I can make use of it and output the nearest face id for each of the pixels in my render?
The face index is a per-triangle property that has to be specified in the scene description and is used as part of Ptex texture mapping. (In other words, it doesn't do what you were expecting.)
Hello,
I want to know the nearest face that the ray intersected for each pixel in the image. I want to write it out to a file. I know there is a faceIndex variable that contain this information in the SurfaceIntersection object. However when I tried I always found that it containts a default value of 0 for each pixel. Is there any way I can make use of it and output the nearest face id for each of the pixels in my render?