mmp / pbrt-v3

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.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.86k stars 1.18k forks source link

Using FaceIndex values per pixel #284

Closed farhanrw closed 4 years ago

farhanrw commented 4 years ago

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?

mmp commented 4 years ago

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.)