Make multi ray in closest hit.

Hi

Is it possible to generate rays in the closest hit?

I want to make ray propagation app.
The generation of diffraction ray is very important in this app.

I want to make diffraction rays when ray hit triangle edge.
It maybe make almost 270 diffraction rays.

But in sample or other internet reference, there is only single ray trace method after closest hit.

Is it possible to generate rays in the closest hit?
Or are there any other good ways or references?

Thanks

Yes, of course.

That could become a problem.
Generating rays inside the closest hit program means you’re implementing a recursive algorithm. Depending on how many recursion depths R your algorithm requires, that could result in 270^R rays to be handled in the worst case which can get huge quite quickly.
There are various runtime limits depending on the operating system, used hardware, and driver mode which would prohibit long running simulations in a single launch, like Windows Timeout Detection and Recovery (TDR) after 2 seconds.

Because many implement a light transport algorithm which doesn’t need more per hit esp. if they work progressively using a Monte Carlo integration.

I might be possible to handle that in a progressive algorithm.
Means whenever hitting an edge which requires diffraction rays to be shot with some spatial distribution, that can also be handled with a Monte Carlo simulation by only following a different of these diffraction rays every time, until the whole simulation converged to a reasonable result.
That is similar to a standard brute force unidirectional path tracer implementations for global illumination.
That algorithm would be iterative and you could shoot as many diffraction rays as you want simply by increasing the number of launches.

Have a look into these threads:
https://devtalk.nvidia.com/default/topic/1065859/optix/optix-scheduling-dynamic-memory-management-/post/5398843
https://devtalk.nvidia.com/default/topic/1036110/optix/wireless-channel-characterization-using-optix-as-a-ray-tracing-engine/post/5264093

Thanks “Detlef Roettger” ^^