CompoundRay is a hardware-accelerated compound eye perspective rendering system and API built on top of the NVidia OptiX raytracing engine.
This is a substantially modified version of the original upstream version of CompoundRay which was written by Blayze Millward. This version removes the C API, modifies the C++ API, removes the Python bindings.
It now builds just the rendering engine library (libcompoundray). There is also an example GUI program.
To build the library you must first install NVidia CUDA and the Nvidia OptiX framework. You can use OptiX 8.0/CUDA 12 or OptiX 9.1/CUDA 13.
You will need these packages to build libcompoundray. Here is the Ubuntu apt install command:
sudo apt install freeglut3-dev libxrandr-dev libxinerama-dev libxcursor-dev glfw3 build-essentialNote that glfw3 and OpenGL are required only to build the gui_example target.
It's the usual cmake install process with one necessary flag for cmake, which sets the path to your OptiX SDK:
cd build
cmake .. -DOptix_INSTALL_DIR=/path/to/NVIDIA-OptiX-SDK-8.0.0-linux64-x86_64/
make
sudo make installI used CUDA 12.1 (not apt package managed), OptiX 8.0
(not apt package managed) and the NVidia driver version 535 (which IS
apt package managed) on Ubuntu 24.04.
Note that you have to use gcc version 12 (or 11) to compile successfully because OptiX 8.0 does not like more recent gcc versions such as Ubuntu 24's default of gcc 13.
If gcc-12 (or 11) IS your default gcc, then you can use this cmake command, where you just have to add the path to the location where you installed the OptiX SDK:
cmake .. -DOptiX_INSTALL_DIR=~/src/NVIDIA-OptiX-SDK-8.0.0-linux64-x86_64/
If gcc-12 is installed, but not your default, you can specify an alternative gcc with a cmake command like:
CC=gcc-12 CXX=g++-12 cmake .. -DOptiX_INSTALL_DIR=~/src/NVIDIA-OptiX-SDK-8.0.0-linux64-x86_64/ -DCUDA_HOST_COMPILER=/usr/bin/g++-12
You can also build with OptiX 8.0 and CUDA 13/driver 610 with these commands.
Use of OptiX 9.1 requires cuda-toolkit (nvcc) version 13.3. cuda toolkit 13.3 requires driver version 6.10. I used the Ubuntu Additional-drivers UI to install the driver metapackage 'nvidia-driver-610-open (proprietary)', which is the correct choice for a 5090 GPU.
These allow the use of gcc 13 (and gcc 14) as the non-cuda compiler. To compile with your default gcc/g++:
cmake .. -DOptiX_INSTALL_DIR=~/src/NVIDIA-OptiX-SDK-9.1.0-linux64-x86_64/
To compile using clang (clang-20) you can call cmake like this:
CC=clang-20 CXX=clang++-20 cmake .. -DOptiX_INSTALL_DIR=~/src/NVIDIA-OptiX-SDK-9.1.0-linux64-x86_64/ -DCUDA_HOST_COMPILER=/usr/bin/clang-20
compoundray reads glTF format files that specify an environment and also camera info.
The glTF will need to have an "extras" tag within any given camera's definition.
An example of this can be seen in compound-ray/data/test-scene.gltf
on line 229, in which a camera is given the additional properties of being compound with the "compound-eye" : "true" property,
the projection schema selected with the "compound-projection" : "spherical_orientationwise" property, and a link to the relative
.eye eye descriptor file (test.eye) added with the
"compound-structure" : "test.eye" property. These properties can be set manually by editing the .glTF file format (which is in
human-readable json, or edited directly on each object (and camera) using the properties
panel in Blender3D.
Sky shaders (as are all shaders) are pulled in from shaders.cu in src. Currently there is one sky shader available,
simple_sky, which can be added as an extra property on the scene itself (see line 19 of the natural environment stand-in gltf file).
Eye structure files can be made as CSVs with the .eye file extension, contents defined here.
See craysim and craysim_minimal to find out how to use libcompoundray and the MulticamScene class.