# Monte Carlo Visibility Optimization

A CMake C++ and CUDA based render framework, to enable visibility optimized volumetric path tracing.

## Project structure
* `Renderer` contains the path tracing render algorithm in the `ArrayRenderer` class 
    along with a raymarch render algorithm in the `RaymarchRenderer` class to compare
* `test_scene` contains an example scene file along with a demo volume courtesy of the University of 
    Utah Center for the Simulation of Accidental Fires and Explosions.
* `cuda`, `external`, `include` and `src` contain the main framework and helper functions
* `include/array.hpp` contains the insertion and read functions of our data structure

## How to compile
Framework requires at least C++20, CMake 3.20 and CUDA 12
1. Download and install the [Cuda Toolkit](https://developer.nvidia.com/cuda-toolkit) and 
   optionally [Optix](https://developer.nvidia.com/rtx/ray-tracing/optix) to enable denoising
2. If Optix is used set `OPTIX_INCLUDE` to the Optix include directory

## How to use
1. Create a scene file according to the sample file `test_scene/heptane.scene`
2. Start the program with a scene file as the argument

## Using importance function
- Use signed distance field volume to specify exact region of importance 
    (needs to be volume of same extend with values 1 where important and 0 where unimportant)
- Position used to render Magnetic Reconnection dataset
- Otherwise uses extinction along the threshold values
- Set importance values in `include/importance.hpp` with `importance*`

## Controls
- WASD to move the camera in FPS mode
- Space to move the camera up in FPS mode
- Shift to move the camera down in FPS mode
- F to switch the camera mode between FPS and arcball
- Hold Ctrl to move slower
- Hold Left Mouse Button to look around or rotate the camera
- Esc to close the application
