ray type issue

During preparing for using OptiX7 I went into this:

In this introduction sample code for an earlier OptiX version
“thePrdShadow” payload is used on the radiance ray type 0, although its the payload for ray type 1.

This could be ok, if the payload structure would have the “seed” element on exact same location in the struct.
But the https://github.com/nvpro-samples/optix_advanced_samples/blob/master/src/optixIntroduction/optixIntro_08/shaders/per_ray_data.h
defines the “seed” element on different position among the payload structs.

I would think here instead the radiance payload should be used with anyhit_cutout in a separate .cu file.

anyhit_cutout() (which is made for the radiance ray type) accesses “thePrdShadow” on ray type 0.
This would end up in accessing the first float of “absorption_ior” in PerRayData. The “seed” element there is not at first offset.

Am I wrong?

I know, its a demonstration sample; no production code; and so its up to the developer to adjust it; and for demonstration purpose it works, but I think updating the seed on anyhit there at least destroys one float of absorption_ior on those pixels.

I think you’re right; it looks like the PRDs are mismatched, at least at a glance since the anyhit function there is for radiance rays and the payload used is for shadow rays. Because the seeds have different offsets in their structs, that will cause problems in OptiX 7, even if somehow it’s working in the OptiX 6 version.


1 Like

Good catch, that’s a copy-paste error. I’ll fix it.
It’s pushed to the optix_advanced_samples github repository now.

1 Like