Skip to content

C++ Path-tracer framework with interactive mode

Notifications You must be signed in to change notification settings

benoit-leveau/Ubik

Repository files navigation

Ubik

WIP C++ Path-tracer framework using SDL for interactivity / display. Modular design to allow for experimentations, so it's easy to implement a new Sampler, Integrator or Renderer.

Current status:

  • Renderer:
    • TiledRenderer (--renderer=tiled) provides tiled rendering with several traversal algorightms. It allows for any number of output drivers:
      • a display driver using SDL so you can see the progress of the render
      • an output driver writing out OpenEXR files
    • InteractiveRenderer (--renderer=interactive) provides interactive progressive rendering and allows to edit the scene using the mouse and keyboard. It uses its own internal progressive sampler so it ignores any sampler specified on the command line.
  • Sampler:
    • FixedSampler (--sampler=fixed) provides fixed sampling (all pixels are evaluated the same number of times). You can specify the number of samples with --samples=N (each pixel will be sampled 2^N times)
    • AdaptativeSampler (--sampler=adaptative) provides adaptative sampling (pixels are sampled at least 2^min_samples times, up to 2^max_samples times or when the variation gets below threshold). Parameters are specified with --min-samples, --max-samples and --threshold.
  • Integrator:
    • PathTracer (--integrator=pathtracer) WIP path tracing using embree
    • SmallPt (--integrator=smallpt) provides path tracing using the "smallpt" algorithm (see References)
    • ImageRender (--integrator=image) is used mainly to test the framework. It reads a TIFF file from disk and "renders" a noisy version of it, ie. each time a pixel of the image is sampled a random noise is added to the RGB value - the idea being that with enough samples the noise should be averaged out.

Usage

Example specifying the sampler, integrator and renderer by name on the command line:

ubik --renderer=tiled --sampler=fixed --samples=2 --integrator=smallpt --width=640 --height=480 --show-window

This will produce the following render: image

Examples

These examples are using the dummy image render integrator. They will be replaced by a proper 3d path render when it's implemented.

Interactive Rendering

video

Tiled rendering

video

Installation

After cloning the main repository, you need to register and update the submodules:

git submodule init thirdparty/ctpl
git submodule init thirdparty/cpp-optparse
git submodule update

The project is built with cmake. Cmake will try to locate the following libraries: SDL2, Tiff, OpenEXR, Embree. If it doesn't find them, you will need to specify them using the syntax shown in the example below.

mkdir -p build
cd build
cmake .. \
    -DSDL2_INCLUDE_DIRS=/code/thirdparty/sdl2/2.0.9/include/SDL2/ \
    -DSDL2_LIBS=/code/thirdparty/sdl2/2.0.9/lib/gcc-6.3.0/libSDL2.so \
    -DTIFF_LIBRARY:FILEPATH=/code/thirdparty/tiff/4.0.4/lib/gcc-6.3.0/libtiff.so \
    -DTIFF_INCLUDE_DIR=/code/thirdparty/tiff/4.0.4/include/ \
    -DOPENEXR_INCLUDE_DIR=/code/thirdparty/openexr/2.2.0/include/ \
    -DOPENEXR_Half_LIBRARY:FILEPATH=/code/thirdparty/openexr/2.2.0/lib/gcc-6.3.0/libHalf.so \
    -DOPENEXR_IlmImf_LIBRARY:FILEPATH=/code/thirdparty/openexr/2.2.0/lib/gcc-6.3.0/libIlmImf.so \
    -DEMBREE_INCLUDE_DIR=/code/thirdparty/embree/3.5.2/include \
    -DEMBREE_LIBRARY=/code/thirdparty/embree/3.5.2/lib/gcc-6.3.0/libembree.so
make

Once built, the executable will be located in the project's bin folder.

External Dependencies:

Other Dependencies:

References

About

C++ Path-tracer framework with interactive mode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published