Home How to Install OptiX and OWL (Draft)
Post
Cancel

How to Install OptiX and OWL (Draft)

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

  3. Open a terminal window and change to the directory you downloaded the Nvidia-OptiX-SDK…sh file in
    1
    
    cd Downloads
    
  4. 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/]
    1
    2
    
    chmod +x NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64-31894579.sh
    ./ NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64-31894579.sh
    
  5. scroll down using the down arrow and type y to accept the license and type y again to adding a subdirectory
  6. Move the folder into a better directory, I moved mine into my home directory.
  7. 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

    1
    2
    3
    
     cd NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64/SDK
     mkdir build
     cd build
    

    ii. run cmake to build files

    1
    
     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

  8. Now make the files by running:
    1
    
    make
    
  9. cd to the SDK/build/bin folder, right click the optixHair file and select run to see if it was successful.
  10. Set the environment variable OptiX_INSTALL_DIR to where you installed the SDK:
    1
    
    export OptiX_INSTALL_DIR=/home/matthew/NVIDIA-OptiX-SDK-7.6.0-linux64-x86_64/SDK/
    
  11. 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:
    1
    
    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
    1
    
    git clone https://git.doit.wisc.edu/MJMULLIN/repo759.git
    
  2. cd to FinalProject759/owl and make a build folder and cd into that
    1
    2
    3
    
    cd repo759/FinalProject759/owl
    mkdir build
    cd build
    
  3. 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.

  4. In your build folder, type cmake .., followed by make
    1
    2
    
    cmake ..
    make
    
  5. Run ./render_helio or ./render_field to make sure you built them correctly
    1
    2
    
    ./render_helio
    ./render_field
    
  6. If successful, you should see .png files in your build folder.
  7. 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:

  • shader binding table (SBT) as mentioned before, a shader is a program that does something to a ray. The shader binding table assigns shaders to specific rays, and records the parameters of each shader. A filled out chunk of the shader binding table that is being read/written to at runtime (when the program is running) for a specified ray is called a record. primitives are shapes that rays can intersect. These shapes include triangles, spheres, curves, etc. They need explicit equations/solutions for determining the points in 2D or 3D space for where a line (a ray) intersects that shape. These primitives form a geometry.
  • acceleration structures are algorithms used to reduce the number of intersection tests a given ray has to compute. An example of one acceleraiton structure is the Bounding Volume Heirarchy (BVH) where the entire scene is divided in a binary fashion into ever smaller boxes. Therefore, when a ray is traversing the scene, it firsts tests if it is in one of 2 boxes, and then gets into smaller and smaller boxes until it either hits an object or flies out of the scene. This reduces the number of hit tests from O(N) to O(log N).
  • A collection of programs, geometries, and acceleration structures forms a node graph.
  • buffers are chunks of memory that get sent to the GPU. A frame buffer (fb) is 1 rendered frame or image (think fps or frames per second).

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

    • variables are parameters for programs (ray generation, miss, etc.) and geoemetries. Instead of populating a shader binding table (SBT), you set variables in OWL and OWL takes care of that.

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)
    1
    
    cmake --version
    
    • if out of date, download the newest version here: https://cmake.org/download/ and install like OptiX
This post is licensed under CC BY 4.0 by the author.

Getting started with Python (Draft)

Analysis of a Solar Thermal Beam-Powered Propulsion Rocket