Draw/visualize rays in OptiX Prime

Hello,

I would like to visualize the ray paths in my OptiX Prime program. Is there any way to give the rays some color to be able to draw them into the rendered ppm file?

Thank you!

Visualize the ray paths as lines in your ray traced image?

Doing that with ray tracing doesn’t make much sense. You would need the rays as some geometry primitives in a separate scene, and ray trace that with a special ray-line intersection routine, and merge that with depth testing to the original rendered image.

The simpler approach would be to render them with the exact same projection with a rasterizer. Look at the OptiX SDK collision example which does something like that for the visibility test rays in the RenderLinesOfSight() routine. (That whole example renders with OpenGL, just the visibility tests are ray traced.)
Correct depth testing against your ray traced image would be an additional challenge.

Doing that visualization for more than a few (secondary) rays at a time in a path traced image will result in serious clutter.

In a pinch it can also be useful to dump the ray of interest to a plain text OBJ file as a skinny triangle or some other simple shape. Then you can load the ray file and possibly the scene geometry into a 3d viewer like Meshlab or Maya, without having to write your own viewer.

Hi,

@Detlef, I am using Optix 5.0.0 SDK. I could not find the collision example.

May I know if this is still included in the samples program ?

@dlacewell, Any hint to dump the ray of interests to record its history so that it can be exported as vectors or line paths ?

Thanks
Kus

you can find that sample in OptiX 3.9.0 SDK:
\OptiX SDK 3.9.0\SDK\collision\CollisionGL.cpp
[url]https://developer.nvidia.com/designworks/optix/downloads/legacy[/url]