This project is a C++/CUDA/NVIDIA OptiX template that performs rapid spatial line-of-sight analysis natively on the GPU. It loads 3D meshes in the .off format, constructs an OptiX Bounding Volume Hierarchy (BVH) from the geometry, and casts hardware-accelerated rays from each vertex of the model towards the origin (0, 0, 0).
The software checks for line-of-sight occlusions and outputs profiling metrics to measure spatial analysis performance. It differentiates between points that have a clear line-of-sight (marked as 0) and those that are occluded by other parts of the geometry geometry before reaching the center (marked as 1).
To build and run this project, you will need the following dependencies:
- C++ Compiler: A C++17 capable compiler (e.g., MSVC on Windows, GCC/Clang on Linux).
- CMake: Version 3.18 or newer.
- NVIDIA CUDA Toolkit: Required for
nvccandbin2c. Note that thebin2cexecutable needs to be in your system's PATH. - NVIDIA OptiX SDK: Version 8.0.0.
- By default, the
CMakeLists.txtassumes it is located at:- Windows:
C:/ProgramData/NVIDIA Corporation/OptiX SDK 8.0.0 - Linux:
/opt/optix
- Windows:
- By default, the
- NVIDIA GPU: Hardware with RT Cores is recommended. The project is currently configured to build for Compute Capability 86 (
sm_86, e.g., Ampere architecture). Update theCMAKE_CUDA_ARCHITECTURESinCMakeLists.txtif using older/newer hardware.
- Ensure the CUDA Toolkit binaries (
nvcc,bin2c) are accessible in your environment's PATH. - Open a terminal in the root directory of the project.
- Run the following commands:
mkdir build
cd build
cmake .. -DOptix_INSTALL_DIR="/opt/optix"
make -j- Run the executable:
./rt_template custom_model.off- Ensure the CUDA Toolkit and OptiX SDK 8.0.0 are installed. Visual Studio with "Desktop Development with C++" must be installed to use compiler tools.
- Open a Developer PowerShell for VS or Developer Command Prompt for VS.
- Navigate to the project directory and run the following commands:
mkdir build
cd build
cmake -G "NMake Makefiles" .. -DOptix_INSTALL_DIR="C:/ProgramData/NVIDIA Corporation/OptiX SDK 8.0.0"
nmake- Run the executable:
.\rt_template.exe custom_model.offAuthor: R. Carrasco
Template created for high-performance GPU Ray Tracing computations.