RepoNVIDIANVIDIApublished Feb 9, 2022seen 5d

NVIDIA/optix-toolkit

C++

Open original ↗

Captured source

source ↗
published Feb 9, 2022seen 5dcaptured 8hhttp 200method plain

NVIDIA/optix-toolkit

Description: Set of utilities supporting workflows common in GPU raytracing applications

Language: C++

License: BSD-3-Clause

Stars: 137

Forks: 24

Open issues: 4

Created: 2022-02-09T16:31:40Z

Pushed: 2026-06-05T21:22:03Z

Default branch: master

Fork: no

Archived: no

README:

OptiX Toolkit (OTK)

The OptiX Toolkit is a set of utilities designed to support applications utilizing the OptiX ray tracing API. Some of the utilities can be used in CUDA programs outside of OptiX as well.

See the [CHANGELOG](CHANGELOG.md) for recent changes.

Most of the OTK utilities are held in the main repository, but some (PyOptiX in particular) have been placed in submodules. To use these, be sure to initialize the submodules before building after checking out the OTK:

git submodule update --init --recursive

Submodules merged in v1.0.0

If you cloned the OptiX Tookit repository prior to v1.0.0, we recommend cloning a fresh repository. We restructured the repository, merging multiple submodules into the main repository, which complicates performing a pull operation. (If you are intent on pulling, use git submodule deinit on all of the submodules except vcpkg before pulling.)

Current Utilities

  • [DemandLoading](DemandLoading) - a C++/CUDA library for on-demand loading of CUDA sparse textures and other assets in OptiX renderers.
  • [Memory](Memory) - Host and device memory pools (used by DemandLoading library).
  • [NeuralTextures](NeuralTextures) - Load neural textures (.ntc files) suitable for the demand loading library.
  • [OmmBaking](OmmBaking) - a C++/CUDA library for baking Opacity Micromap Arrays for textured geometry.
  • [PyOptiX](https://github.com/NVIDIA/otk-pyoptix/) - Complete Python bindings for the OptiX host API.
  • [ShaderUtil](ShaderUtil) - Header-only libraries for OptiX kernels (e.g. Vector Math, Self Intersection Avoidance, Ray Cones, Environment Map Sampling, Stochastic Texture Filtering, Cubic Texture Filtering).

Requirements

  • C++ compiler (gcc, Clang, or Visual Studio)
  • git (any modern version with LFS) (download)
  • CMake 3.27 or later (download).
  • Using the latest CMake is highly recommended, to ensure up-to-date CUDA language support.
  • CUDA 11.1 or later (download)
  • OptiX 7.6 or later (download)
  • Other third-party libraries are downloaded and built on demand (see below).

On some Linux systems it may be necessary to install some commonly used developer packages with the following commands:

sudo apt-get install curl git-lfs pkg-config
git lfs install

Building the examples included with the OptiX Toolkit requires an OpenGL development environment. On most Linux systems the necessary packages can be installed using the following command:

sudo apt-get install libx11-dev libxcursor-dev libxi-dev libxinerama-dev libxrandr-dev mesa-common-dev

Under Rocky linux, the following packages must be installed to build the GL-based OTK examples:

sudo dnf install libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel mesa-libGLU-devel pkg-config

Specifying the Location of the OptiX SDK (optional)

The OptiX SDK headers will be downloaded (via FetchContent) if no installed version of the OptiX SDK is found. On Windows, the standard installation location %ProgramData%/NVIDIA Corporation is searched; on Linux, the locations /opt, /usr/local, $HOME and $HOME/Downloads are searched for the default SDK directory name.

If you installed the OptiX SDK in another location, or using a different directory name than the suggested default, you can specify the location of the OptiX SDK by setting the CMake variable OptiX_INSTALL_DIR (case sensitive) at CMake configure time. Set the variable to the path to the directory containing the OptiX SDK include directory.

Building the OptiX Toolkit with the Supplied CMake Presets

CMake presets provide a convenient means of specifying CMake configure settings, build settings and test settings as a named collection. A CMakePresets.json file is provided with the toolkit to cover some basic use cases and for use as building blocks to create your own presets that cover your specific use cases.

To build the toolkit with default settings, issue the following command from the source code directory.

cmake --preset otk-default
cmake --build --preset otk-default -j

The following command runs the tests using the default preset. (Note that ctest requires a value for the -j option.)

ctest --preset otk-default -j 16

All supplied presets begin with the prefix otk- so that they won't conflict with your personal presets. It is recommended that you store your personal presets in the file CMakeUserPresets.json in the source directory so that future updates to the toolkit won't conflict with your personal presets.

The supplied presets create build directories as children of the source directory with the name of the preset in the build directory name, e.g. build-otk-default. This gives each preset a distinct build directory allowing you to experiment with different presets without them interfering with one another.

Consult the CMakePresets.json file for the available building blocks for use in creating your own customized preset that suits your individual needs.

Building the OptiX Toolkit Manually

The OTK can be built manually following the standard CMake worfklow, as described below:

  • Create a directory called build and cd to that directory.
mkdir build
cd build
  • Configure the toolkit using CMake, optionally [specifying the location of the OptiX SDK](README.md#specifying-the-location-of-the-optix-sdk). This can be accomplished using the CMake GUI tool, the CMake console tool (not available on Windows as of this writing), or from the command-line directly by entering the following command: (Note that .. specifies the path to the source code from the build directory.)
cmake ..

This will configure the toolkit with the default options create a build project using the default CMake…

Excerpt shown — open the source for the full document.

Notability

Scored, but no written rationale attached yet.

NVIDIA has a repo signal matching infrastructure, product and customer.