Looking for raytracing shader example

Hi everyone,
I’m looking for an example for a ray tracing shader that I could implement in UE5.

I have several question about how to implement it, and a simple example could clarify many of these.
These are mainly my questions:

  1. How do I get the accelerated structure from the scene? (I want to use the existing geometries)
  2. I want to trace my rays a bit unconventionally; from a rect, towards the side (i.e. not from the plane normal), so I want to know if I can control the amount of rays being shot. from my understanding the amount is restricted to the current camera pixel amount.
  3. how do I declare the different shaders such as closesthit and anyhit?
  4. Where can I find the mapping between the instance index in the attribute of the hit to the actual geometry and object in scene.

Did not find one, made one, made tutorial

Haha, you are awesome! Thanks for sharing! :heart:

1 Like