Hey I’m glad to hear the upgrade is bringing improvements!
For intersection programs in OptiX 7, you can report additional intersection attributes, like normals, to the function
optixReportIntersection(). You’ll notice there are up to 8 generic 32-bit parameters you can pass, in addition to the
hitKind parameters. Then in your hit programs, you can use the
optixGetAttribute_n() functions where n is 0 through 7, to access the attributes that were written in the intersection program.
In an OptiX 7 intersection program, when you want to declare a ray miss, you can simply return from the intersection program without calling
optixReportIntersection(). So, there is no need to have any replacement for the older
Make sure to return early on a miss before doing additional work to compute your attributes, since work done to compute attributes is wasted on misses. It’s also common (and sometimes more efficient) to let that work bleed over to the hit program instead, even if it seems like there is some redundant calculation. The hit programs are typically called far less often than intersection programs, so doing a little extra work to compute normals in the hit program might be overall better than doing the work during intersection. The hit programs always need the attributes, where the intersection programs don’t always need to compute them, so doing the work in the hit shader can improve divergence as well.
Here are a few pointers to some relevant sections in the Programming Guide: