ingowald / optix7course

Apache License 2.0
452 stars 80 forks source link

ex09_shadowRays and ray type usage #10

Closed kyamant closed 2 years ago

kyamant commented 3 years ago

Since the content of __closesthit__shadow()`` __anyhit__shadow() is removed, theSHADOW_RAY_TYPE for SBT offset usage is meaningless, since those 2 shaders were associated with SHADOW_RAY_TYPE. Even though the (secondary) optixTrace() call in __closesthit__radiance() uses SHADOW_RAY_TYPE for SBT offset, it does not have any effect.

This is supposed to be a tutorial (for people trying to learn) and this neglect made it confusing.

Not updating the Sig 19 OptiX 7 -Tutorial.pdf according to the changes is not helpful either.

ingowald commented 3 years ago

Only just seen this. Had a look at the code, and to me it looks correct (it's the miss program that has the intended effect).

Now if I understand your criticism correctly it's that I wouldn't have needed the ray type and (empty) CH/AH programs, and could instead have just "abused" the radiance ray with the appropriate flags. This is indeed true, but whether that is more or less clean of a solution is probably in the eye of the beholder.

That said, a way that would have been cleaner would have been to not use that tick with the miss program at all, and instead use the AH program with optixTerminateRay to set visibitly flag to 0. If you want to submit a PR to that effect, I'd be happy to merge it in.