How to develop user defined rendering in OptiX

Hello,
I may ask a naive question. After proper installation of the driver, CUDA toolkit, and Optix (v7.3) if I want to start developing my own rendering algorithm, will only the inculde directories' header files under OptiX SDK 7.3.0 (C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.3.0\include) be enough to use all the built-in functions and methods of the OptiX framework? Does it also include the image read, write, window creation (like GLUT)?

As OptiX comes with the sample code, with few additional header files under support, cuda, lib, and sutil folder, Besides the OptiX Inculde headers, do I also need those (e.g., for image read and write)? Should I add those headers manually to the project properties in visual studio project? Or only the OptiX include directory will contain all the required function?

The answer is effectively the same as with your foveated rendering question.

After proper installation of the driver, CUDA toolkit, and Optix (v7.3) if I want to start developing my own rendering algorithm, will only the inculde directories' header files under OptiX SDK 7.3.0 (C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.3.0\include) be enough to use all the built-in functions and methods of the OptiX framework?

Yes, the core OptiX 7 API is header only. The include directory contains everything you need to access the OptiX API core functions and provides some additional helper functions, to calculate an OptixPipeline’s stack size on the host, or concatenate the current transformation matrices when using a more complicated transforma hierarchy (e.g. when using motion blur).
Those OptiX 7 headers plus the CUDA toolkit (OptiX 7.3.0 has been built with CUDA 11.1, so that is the recommended CUDA version) is everything you’d need to develop GPU accelerated ray tracing algorithms with OptiX 7.

Does it also include the image read, write, window creation (like GLUT)?

Not really. Everything else, like windowing systems, loading or saving of any file formats, let it be scenes or images, GUI interaction with any input device (mouse, controller, HMD, etc.) and even the display of the synthesized images is not part of the OptiX API.

But since the OptiX SDK examples should show some interesting images, there is this small sutil library which helps loading OBJ and glTF files (not all of them, there is still an open alignment bug of the vertex attributes) or load and save some simple image formats (PNG, PPM). The windowing framework is GLFW and OpenGL (the GLAD helpers load the OpenGL API entry points) to display images and the GUI which is using ImGUI.

You do not need to use the sutil library or any of the other libraries in your own application. It’s only there to make the OptiX SDK samples shorter. It also adds some undesirable quirks.

For example, in my OptiX 7 examples I only use the OptiX 7 SDK headers and the CUDA Toolkit which actually offers two APIs as well, the Runtime and the Driver API. (The OptiX SDK examples show only the Runtime API.)

Everything else is done with third party libraries:
I’m also using GLFW as windowing system (GLUT is too old), GLEW for the OpenGL and extensions API, ImGUI for the GUI rendering and interaction, DevIL for loading and saving images of various file formats (you could also use freeimage), and ASSIMP for scene geometry (only the meshes, not points, lines or materials).

Both the OptiX SDK examples and my own examples use CMake to build the projects and solution to make this cross platform. I’m using a different custom CUDA to PTX compilation rule which is easier to modify and doesn’t bloat the *.ptx filenames.

It would also be possible to setup this compilation step without CMake in MSVS directly by using the CUDA Visual Studio Integration, but some care would need to be taken to get all settings right (compute and SM version, no debug code, line info, no cubins but ptx output only, keep device functions or relocatable device code, etc.). I never used that method for OptiX examples.

If you’re interested please have a look at the OptiX 7 related links in this post
https://forums.developer.nvidia.com/t/optix-advanced-samples-on-github/48410/4

Also follow the OptiX 7.2 release link in this post for even more examples:
https://forums.developer.nvidia.com/t/optix-7-3-release/175373

Again you do not need to use any of that in your own application either. These are just examples.

There are many other ways to build an application framework in which you can use OptiX 7.
You wouldn’t even need to use C/C++ because the OptiX API has always been C-based and you could write wrappers over the API entry points in any language that supports that.

1 Like

@droettger , thank you very much for your all details explanation. Now I have much better understanding.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.