Reflections in Optix Prime

Hi, I’m currently starting to write a radar imaging program using optix prime. The basic breakdown is that I make a set of rays that shoot to the center of every facet of a triangle mesh and read the far-field response using information about the angle of intersection between the ray origin and the triangle plane. So far, it’s been working fine.

The issue is that I would like to support refraction/reflection by making new rays at the point of intersection. I can make this new second set of rays (would just be a matter of cross referencing the triangle ID of the hits with the ray origin, which all initial rays share), but then we have a bunch of different origins for this second set of rays, and I can’t see any easy way to find the angle of incidence for this second set of rays without knowing what their common origin is.

My question boils down to: Is there any way to return some information about the ray that caused the hit within the hit data structure? As far as I can tell (I may well have missed something) the only information I get back is t (the distance), triId (the ID of the triangle), u and v (barycentric coordinates; i.e., where on the triangle it hit). Or is Optix prime not going to work for my purposes? The simple API is extremely attractive since I only need simple static imaging, and I’d prefer to use prime, but if it’s not possible I’ll have to give it up.

EDIT: Oh, and my hit buffer has like 250k hits, even though 249750 of them are misses. What’s up with that? Does it just make a “hit” for every ray-facet pair?

I am doing something very similar, I use OptiX for EM wave propagation to simulate wireless communication scenarios.

I do not use OptiX prime since I need to have custom geometry and want to model refraction, diffraction and reflection. The “normal” OptiX API is (IMHO) much more suited for such requirements.

Yeah, and now I’m looking in more detail at the hits and it seems like I’m getting a lot less hits than one would expect. Even though I create each ray so that it shoots to a triangle center, I get less than half as many hits as I have triangles. I may have to buckle down and familiarize myself with the full Optix API.

On your first question about the secondary rays:
You have all information required to do that. The ray buffer and the hit buffer are the same size, means for every hit you encounter, the ray which caused that hit is still in your ray buffer at the same index. Just use that information to calculate your reflection ray into the ray buffer you would query next.

Oh, I didn’t realize they corresponded in that way. That’s helpful. Maybe I have some error in my ray generation code that is making a bunch of dummy hits, then. Thanks.

Ooo! That’s a really cool project that you are working on. Will it be open-source? I am really eager to follow your progress.