Simple Optix Example


I am beginning to study Optix. I have downloaded all the latest resources and documentation. I have started looking over some of the tutorials and examples and I am finding the learning curve rather steep.

I am looking for a simple example that would show how to use Optix to intersect a very simple triangle mesh with a ray. For example, say a flat sheet plate of 2 or more triangles in the z = 0 plane with a ray launched from a given beg point and direction looking into the triangle scene. Such an example would be isolated from glut displays, pin hole cameras, phong materials, opengl rendering, etc … I don’t understand why all the samples and tutorials need be so complicated with all these other aspects of ray tracing. I am suggesting at least one simple example showing nothing but bare minimal Optix usage and computations on tracing ray hits over a mesh of triangles (and keep the mesh simple). The application I have in mind doesn’t need all those other peripheral pieces. I just need to know what triangle was hit, where the ray hit on the triangle (u,v) coordinates, and perhaps the ray length from beginning of ray to hit point.

As a comparison, I just finished studying Embree and I was up and running ray tracing on simple meshes in roughly 4 hours from download time. I am seeing a much longer delay for Optix. I do realize GPU computing is far more complicated than CPU computing but I still think there is an opportunity for demonstrating examples on an aspect of ray tracing similar to what I described above.

If anyone would like to share such an example I would be grateful.

Mind that the OptiX SDK contains two raytracing APIs: OptiX and OptiX Prime.

OptiX is a general purpose GPU accelerated ray casting SDK which allows complex scene hierarchies and full programmability in CUDA C++ of the given program domains using a single ray programming model, which allows for custom primitive intersections, recursions, user defined per ray payloads, etc.
It’s GPU ray tracing “to the algorithm”. Yes, the learning curve can be steep depending on how you start looking at it.

If you only need to shoot a number of rays and get intersection results similar to Embree, you need to compare it to OptiX Prime which is a low-level intersection API doing only that. Everything else like ray generation, lighting and shading is your responsibility.

Please have a look at the OptiX SDK examples with “prime” in the name if you’re only interested in accelerating ray intersections.

My recommended approach to start learning OptiX is still this:

Ah yes. I see the distinction on the main Optix web page, and I see the “prime” examples you noted. However, the tutorials and samples do not distinguish the two, or at least I did not see the distinction until you pointed it out. Never-the-less, I believe Optix Prime is indeed the best place to start for me and I am grateful for your recommendation. I will start with prime. Perhaps the future documentation and examples can include a “prime” example discussion for those of us in the field that just need raw ray intersection computational horsepower versus ray trace rendering.