This is the sample code for the paper: S. Zellmann, J. Amstutz: "A Practical Guide to Implementing Off-Axis Stereo Projection Using Existing Ray Tracing Libraries"
The sample app runs on the command line and executes the three camera strategies described in the paper. The output are .png images for each of the three strategies. On success, the projection generated by the three strategies should match.
Building requires v0.8.0 (or newer) of the ANARI SDK (we use the next_release
branch).
The sample app was tested on macOS and on Ubuntu 22.04 and can be built like this:
mkdir build
CMAKE_PREFIX_PATH=<anari-root-dir> cmake <sources>
make
To run it, you need an ANARI device. Any compliant device will work, but to run
Strategy 1 from the paper the anari-visionaray device is required, which
provides the ANARI_VSNRAY_CAMERA_MATRIX
extension. ANARI devices must be set
using the environment variable ANARI_LIBRARY
:
ANARI_LIBRARY=visionaray anari-offaxis-sample
The relevant parts of the code are found in Projection.h where the the three strategies are implemented, and in main.cpp where they are executed. The implementation of Strategy 1 (camera rays are directly created using OpenGL-style projection and model/viewing matrices) is delegated to an external ANARI device implementation (currently, the required extension is implemented only by the anari-visionaray device).
Apache 2