How to Install OptiX and OWL (Draft)

January 21, 2023

OptiX Documentation (for 759 students)

Here is a summary of the steps to get OptiX running on a computer and an explanation of the software for reference

Installation

  1. Register as a developer on Nvidia's website: https://developer.nvidia.com/user
  2. Download OptiX 7.6 SDK (only available on Windows or Linux): https://developer.nvidia.com/designworks/optix/download
    • older versions are available for MAC and other OS, including ARM

Linux Install

  1. Open a terminal window and change to the directory you downloaded the Nvidia-OptiX-SDK...sh file in
cd Downloads
  1. install the SDK on your machine using the following commands (NOTE: you can use tab to autocomplete the name of the shell script) [source: https://www.cyberciti.biz/faq/run-execute-sh-shell-script/]
chmod +x NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64-31894579.sh
./ NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64-31894579.sh
  1. scroll down using the down arrow and type y to accept the license and type y again to adding a subdirectory

  2. Move the folder into a better directory, I moved mine into my home directory.

  3. Then open up the folder and follow the instructions in SDK/INSTALL-LINUX.txt

    i. cd into the SDK directory, make a new build directory, and cd into that directory

    cd NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64/SDK
    mkdir build
    cd build

    ii. run cmake to build files

    ccmake /home/matthew/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64/SDK/ 

    iii. once in cmake interface, type in c, and type e once the process is done. For now, we are just going to generate the release build. We will generate the debug build at a later time. iv. type c again e and type g

  4. Now make the files by running:

make
  1. cd to the SDK/build/bin folder, right click the optixHair file and select run to see if it was successful.
  2. Set the environment variable OptiX_INSTALL_DIR to where you installed the SDK:
export OptiX_INSTALL_DIR=/home/matthew/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64/SDK/
  1. You should now be able to move the OptiX sample files into any directory (if you also copy over the CMake, build, data, cuda, sutil folders) and build; however, you may need to change CMake/FindOptiX.cmake line 32:
set(OptiX_INSTALL_DIR "/home/matthew/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64") #where the path in quotations is the path to the folder where you installed OptiX.

Building FinalProject759 Code

  1. Open a new terminal window and clone this repository
git clone https://git.doit.wisc.edu/MJMULLIN/repo759.git
  1. cd to FinalProject759/owl and make a build folder and cd into that
cd repo759/FinalProject759/owl
mkdir build
cd build
  1. change set(OptiX_INSTALL_DIR "/home/matthew/OptiX") in repo759/FinalProject759/owl/owl/cmake/FindOptiX.cmake to wherever your OptiX Install Directory is. NOTE: You may have to also export OptiX_INSTALL_DIR as an environment variable. This step is tricky.

  2. In your build folder, type cmake .., followed by make

cmake ..
make
  1. Run ./render_helio or ./render_field to make sure you built them correctly
./render_helio
./render_field
  1. If successful, you should see .png files in your build folder.
  2. The code that generated this is under FinalProject759/owl/samples/cmdline/s33-render_field

OptiX Explanation

OptiX is a Nvidia GPU-optimized ray tracing toolkit. It is fairly lowlevel API and requires explicit control of memory management. Because ray tracing is an "embarassingly parallel problem" (i.e. each ray operates independent of one another), each ray is assigned a ray tracing pipeline. Within the pipeline, there are programs (other toolkits often refer to these programs as shaders). Each program does something to a ray: ray generation, ray intersection, ray hits, etc. Here's an explanation of all the jargon that is used:

Because OptiX 7.x is very low level (and somewhat indecipherable to the unannointed), it instead makes sense to use a higher level wrapper API built on top of Optix 7, which is OWL.

OWL (Optix Wrapper Library) Documentation (for 759 students)

Installation

Link to repo: https://github.com/owl-project/owl

  1. clone repo
  2. modify owl/Cmake/FindOptiX.cmake

OWL Explanation

Optix Advanced Examples

Cmake crash course

In order to build with OptiX, you will need to understand the basics of Cmake. Good resources are found here: https://www.youtube.com/watch?v=_yFPO1ofyF0&list=PLK6MXr8gasrGmIiSuVQXpfFuE1uPT615s. The following instructions will be from a Linux perspective (use WSL2 if on Windows)

  1. check what cmake version you have (if you don't have one, install it)
cmake --version