Essentially, only the latest set acceleration structure seems to work. Attempting to cast rays with any but the latest one set results in anything it hits simply eating the ray and not actually executing the closesthit shader. Note, this also prevents it from executing the miss shader, so it IS hitting it, just not executing the proper code.
Is this a bug, limitation, or am I just missing something?
This makes me sad, but I made a work around anyways. Just shoved off the things I needed in the second acceleration structure really far away and offset my rays over there when I needed to trace against them. It’s not ideal, but I suppose it works anyways.
You can also use ray-instance masking. When you add instances to an acceleration structure you can specify an instance mask and when you cast rays with TraceRay HLSL function you can specify the same mask.
For example:
rtas.AddInstance(…, 1, …) and
rtas.AddInstance(…, 2, …) for the mask argument and in HLSL you can mask the instances:
TraceRay(…, 1, …) or TraceRay(…, 2, …) for InstanceInclusionMask argument.