In my ray generation program, I would like to sample points on a geometric instance so that I can launch rays from it in my ray generation program. But the problem is I only know the coordinates in object space and I need world space coordinates for a ray generation program.
So for example, let’s say you had thousands of rectangular light sources in a scene and want to launch rays from them (note that the lights need to be instances too since I want to intersect rays with them). I don’t want to have to pass the four vertices for each instance via a buffer or variable because that will waste a ton of memory. I already have set the transformation matrix for each instance, so that gives all the information I need. Ideally, I would like to query the transformation matrix for each instance in my ray generation program so I can use it to transform sampled points into world coordinates. However rtTransform* is not supported within ray generation programs for obvious reasons. Is there any other way to get an instance’s transformation matrix from within a ray generation program? The only way I can think of would be to launch a ray that I know will hit only the instance, then sample the rectangle from the hit program where I can use rtTransform*, but this would be very computationally wasteful.