• Stars
    star
    594
  • Rank 74,814 (Top 2 %)
  • Language
    C++
  • License
    MIT License
  • Created over 5 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An example path tracer that runs on multiple ray tracing backends (Embree/DXR/OptiX/Vulkan/Metal/OSPRay)

ChameleonRT

CMake

An example path tracer that runs on multiple ray tracing backends (Embree/Embree+SYCL/DXR/OptiX/Vulkan/Metal/OSPRay). Uses tinyobjloader to load OBJ files, tinygltf to load glTF files and, optionally, Ingo Wald's pbrt-parser to load PBRTv3 files. The San Miguel, Sponza and Rungholt models shown below are from Morgan McGuire's Computer Graphics Data Archive.

Binaries built for each platform with support for all rendering backends available on that platform can be downloaded from the Releases or the latest Actions artifacts. On Linux set the LD_LIBRARY_PATH to include the directory where you extract the application, on macOS do the same for DYLD_LIBRARY_PATH. On macOS you may need to do some tweaking/security allowances to get the application to run. Only x86_64 binaries are provided for macOS at the moment.

San Miguel, Sponza and Rungholt

Controls

The camera is an arcball camera that moves around the camera's focal point.

  • Zoom in/out using the mousewheel. (Two-finger scroll motion on MacBook Pro etc. trackpad.)
  • Click and drag to rotate.
  • Right-click and drag to pan. (Two-finger click and drag on MacBook Pro etc. trackpad.)

Keys while the application window is in focus:

  • Print the current camera position, center point, up vector and field of view (FOV) to the terminal by pressing the p key.
  • Save image by pressing the s key.

Command-line Options

-eye <x> <y> <z>       Set the camera position
-center <x> <y> <z>    Set the camera focus point
-up <x> <y> <z>        Set the camera up vector
-fov <fovy>            Specify the camera field of view (in degrees)
-camera <n>            If the scene contains multiple cameras, specify which
                       should be used. Defaults to the first camera
-img <x> <y>           Specify the window dimensions. Defaults to 1280x720

Ray Tracing Backends

The currently implemented backends are: Embree, DXR, OptiX, Vulkan, and Metal. When running the program, you can pick which backend you want from those you compiled with on the command line. Running the program with no arguments will print help information.

./chameleonrt <backend> <mesh.obj/gltf/glb>

All five ray tracing backends use SDL2 for window management and GLM for math. If CMake doesn't find your SDL2 install you can point it to the root of your SDL2 directory by passing -DSDL2_DIR=<path>. GLM will be automatically downloaded by CMake during the build process.

To track statistics about the number of rays traced per-second run CMake with -DREPORT_RAY_STATS=ON. Tracking these statistics can impact performance slightly.

ChameleonRT only supports per-OBJ group/mesh materials, OBJ files using per-face materials can be reexported from Blender with the "Material Groups" option enabled.

To build with PBRT file support set the CMake option CHAMELEONRT_PBRT_SUPPORT=ON and pass -DpbrtParser_DIR=<path> with <path> pointing to the CMake export files for your build of Ingo Wald's pbrt-parser.

Embree

Dependencies: Embree 4, TBB and ISPC.

To build the Embree backend run CMake with:

cmake .. -DENABLE_EMBREE=ON \
	-Dembree_DIR=<path to embree-config.cmake> \
	-DTBB_DIR=<path TBBConfig.cmake> \
	-DISPC_DIR=<path to ispc>

You can then pass embree to use the Embree backend. The TBBConfig.cmake will be under <tbb root>/cmake, while embree-config.cmake is in the root of the Embree directory.

Embree + SYCL

Dependencies: Embree 4, TBB and Intel's oneAPI toolkit and the nightly SYCL compiler. Currently (4/4/2023) the Embree4 + SYCL backend requires the 20230304 nightly build of the oneAPI SYCL compiler and the latest Intel Arc GPU drivers. I have tested with driver version 31.0.101.4255 on Windows, it seems that the Ubuntu drivers are on an older version with their last release showing as being in Oct 2022. The regular oneAPI Base Toolkit is also required to provide additional library dependencies, and the build must be run within the oneAPI tools command line (or with the build environment scripts source'd).

After opening the oneAPI command prompt you can start powershell within it, then to build the Embree4 + SYCL backend run CMake with:

cmake .. -G Ninja `
    -DCMAKE_C_COMPILER=<path to dpcpp nightly>/bin/clang.exe `
    -DCMAKE_CXX_COMPILER=<path to dpcpp nightly>/bin/clang++.exe `
    -DENABLE_EMBREE_SYCL=ON `
    -Dembree_DIR=<path to embree-config.cmake> `
	-DTBB_DIR=<path TBBConfig.cmake>
cmake --build . --config relwithdebinfo

You can then pass embree_sycl to use the Embree4 + SYCL backend. The TBBConfig.cmake will be under <tbb root>/cmake, while embree-config.cmake is in the root of the Embree directory.

Note that building the Embree4 + SYCL backend is currently incompatible with OptiX since the compiler is not supported by CUDA. You can simply build the OptiX backend (or the Embree4 + SYCL) backend in a separate build directory to get builds of both.

OptiX

Dependencies: OptiX 7.2, CUDA 11.

To build the OptiX backend run CMake with:

cmake .. -DENABLE_OPTIX=ON

You can then pass optix to use the OptiX backend.

If CMake doesn't find your install of OptiX you can tell it where it's installed with -DOptiX_INSTALL_DIR.

DirectX Ray Tracing

If you're on Windows 10 1809 or higher, have the latest Windows 10 SDK installed and a DXR capable GPU you can also run the DirectX Ray Tracing backend.

To build the DXR backend run CMake with:

cmake .. -DENABLE_DXR=ON

You can then pass dxr to use the DXR backend.

Vulkan KHR Ray Tracing

Dependencies: Vulkan (SDK 1.2.162 or higher)

To build the Vulkan backend run CMake with:

cmake .. -DENABLE_VULKAN=ON

You can then pass vulkan to use the Vulkan backend.

If CMake doesn't find your install of Vulkan you can tell it where it's installed with -DVULKAN_SDK. This path should be to the specific version of Vulkan, for example: -DVULKAN_SDK=<path>/VulkanSDK/<version>/

Metal

Dependencies: Metal and a macOS 11+ device that supports ray tracing.

To build the Metal backend run CMake with:

cmake .. -DENABLE_METAL=ON

You can then pass metal to use the Metal backend.

OSPRay

Dependencies: OSPRay 2.0, TBB.

To build the OSPRay backend run CMake with:

cmake .. -DENABLE_OSPRAY=ON -Dospray_DIR=<path to osprayConfig.cmake>

You may also need to specify OSPRay's dependencies, ospcommon and OpenVKL, depending on how you got or built the OSPRay binaries. If you downloaded the OSPRay release binaries, you just need to specify that path.

You can then pass ospray to use the OSPRay backend.

Citation

If you find ChameleonRT useful in your work, please cite it as:

@misc{chameleonrt,
	author = {Will Usher},
	year = {2019},
	howpublished = {\url{https://github.com/Twinklebear/ChameleonRT}},
	title = {{ChameleonRT}}
} 

More Repositories

1

tray_rust

A toy ray tracer in Rust
Rust
513
star
2

TwinklebearDev-Lessons

Source code and assets for the TwinklebearDev Tutorials
C++
323
star
3

webgl-volume-raycaster

A WebGL Volume Raycaster
JavaScript
245
star
4

tobj

Tiny OBJ Loader in Rust
Rust
231
star
5

fbed

Python FFmpeg Batch Encoding Dashboard
Python
121
star
6

webgl-marching-cubes

An example of marching cubes in WebGL, using Rust + WebASM to compute the isosurface
JavaScript
87
star
7

ispc-rs

Rust library for build scripts to compile ISPC code into a Rust library
Rust
84
star
8

tray

A toy ray tracer
C++
70
star
9

dxr-ao-bake

A demo of ambient occlusion map baking using DXR
C++
57
star
10

webgpu-bcmc

WebGPU Data-Parallel Block-Compressed Marching Cubes Isosurface Extraction
JavaScript
53
star
11

webgpu-0-to-gltf

Code for my From 0 to glTF with WebGPU blog series
TypeScript
49
star
12

webgpu-experiments

A series of examples written while learning about WebGPU
JavaScript
48
star
13

webgpu-marching-cubes

A GPU-parallel Marching Cubes implementation using WebGPU
TypeScript
48
star
14

bspline

Generic B-Spline Curves in Rust
Rust
40
star
15

webgpu-gltf

A glTF loader and viewer using WebGPU
JavaScript
39
star
16

wgpu-cpp-starter

Starter project for cross platform WebGPU development in C++
C++
39
star
17

embree-rs

Rust bindings to Embree 3
Rust
34
star
18

webgpu-cpp-gltf

C++
31
star
19

webgpu-webpack-starter

A starter template for WebGPU development using webpack
JavaScript
29
star
20

asteroids

An over-engineered implementation of Asteroids
C
29
star
21

lfwatch

A LightFileWatcher
C++
27
star
22

webgl-ewa-splatter

An EWA surface splatter in WebGL
JavaScript
26
star
23

webgpu-cpp-wasm

Template to get started with SDL2 + WebGPU C++ -> Native/Wasm projects
C++
26
star
24

arcball-cpp

A Shoemake Arcball camera in C++
C
25
star
25

oidn-rs

Rust bindings to Intel's OpenImageDenoise Library
Rust
25
star
26

spline-viewer

A viewer for B-spline curves and surfaces
Rust
20
star
27

webgpu-volume-pathtracer

This is a WebGPU implementation of a volume path tracer that uses delta tracking to sample the volume.
JavaScript
19
star
28

webgpu-prog-iso

Code for the paper "Speculative Progressive Raycasting for Memory Constrained Isosurface Visualization of Massive Volumes"
JavaScript
18
star
29

webgpu-volume-raycaster

JavaScript
18
star
30

LPCGame

Working on a C++ tile based 'engine' using SDL
C++
17
star
31

imgui-transfer-function

A transfer function widget implemented using ImGui
C++
16
star
32

webgl-neuron

An SWC + Volume/TIFF Stack Viewer in WebGL
JavaScript
16
star
33

tobj_viewer

A very simple Wavefront OBJ viewer using tobj and glium
Rust
15
star
34

webgl-util

A set of barebones utilities for playing with WebGL
JavaScript
15
star
35

topo-vol

Topology Guided Volume Exploration
C++
15
star
36

sdl2_vulkan

SDL2 + Vulkan
C++
14
star
37

micro-packet

A micro packet ray tracer
C++
14
star
38

ChameleonRT-lang

A hobby language and API for cross API and cross platform ray tracing
C++
13
star
39

vulkan-marching-cubes

A GPU-parallel implementation of Marching Cubes in Vulkan
C++
12
star
40

webgpu-isosurface-raycaster

A WebGPU Isosurface Raycaster
JavaScript
10
star
41

tray_rust_blender

tray_rust plugin for Blender
Python
9
star
42

light_arena

A lightweight, placement based memory arena
Rust
9
star
43

webgpu-cpp-usdz

Trying out Rendering USDZ
C++
9
star
44

arcball

A Shoemake arcball camera in Rust
Rust
8
star
45

webgpu-webpack-typescript-starter

A starter template for WebGPU development using webpack and TypeScript
TypeScript
8
star
46

ssao

Sort of an implementation of Scalable Ambient Obscurance, but not quite
C++
8
star
47

OpenCL-OpenGL-Interop

Fiddling around with OpenCL/OpenGL Interop and using SDL2 for windowing
C++
8
star
48

mini-osp-vis

A Mini-app Example for Scientific Visualization Using OSPRay
C++
7
star
49

build-ship-dbg-wasm

Code for my blog post on building, shippping, and debugging WebAssembly
C++
7
star
50

libbat

Scalable adaptive I/O for particles
C++
6
star
51

Twinklebear.github.io

My website
JavaScript
6
star
52

sdl2_dx12

C++
5
star
53

webgl-volume-animation

Play back 3D volumetric time series data
JavaScript
5
star
54

ship-wasm-npm

Code for my blog post on shipping and using Wasm in an NPM package
CMake
5
star
55

sdl2_metal

An example app of using Metal to render to an SDL2 window
CMake
5
star
56

theta-tunnel

A script for tunneling ports onto Theta compute nodes for remote visualization
Shell
5
star
57

Charm-experiments

Different code written while checking out Charm++
C
5
star
58

uu-dissertation-template

IEEE Style CS Dissertation Template for Univ. of Utah
TeX
5
star
59

3D-Tiles

Fast 3D tile style map rendering
C
4
star
60

Nano-BMP

A minimal BMP library
C
4
star
61

pico_bench

A minimal C++11 benchmarking library.
C++
4
star
62

mini-cinema

A Cinema-style mini-app example for OSPRay
C++
4
star
63

wgpu-rs-test

Trying out Rust + WebGPU via wgpu-rs for cross platform native/web graphics
Rust
4
star
64

ffmpeg-slideshow-py

Easily make a slideshow with crossfade image transitions using FFmpeg
Python
4
star
65

crafting-interpreters

Working through https://craftinginterpreters.com/
C++
3
star
66

vsbillboards

A demo of quickly rendering camera-facing 3d billboards using the vertex shader.
C
3
star
67

eigen_vec3.ispc

Joachim Kopp's hybrid 3x3 real-symmetric eigenvector & value solver in ispc
C
3
star
68

ospray_starter

Get started quickly with developing an OSPRay app or custom module
C++
3
star
69

zed-vive-mr

A mixed reality test and manual calibration app for the ZED using OpenVR
C++
3
star
70

osp-mpi-distrib-samples

Small tutorial samples of the OSPRay MPI Distributed Device
C++
3
star
71

crescent

A MoonRay inspired ray tracer
Rust
3
star
72

osp-distrib-viewer

A distributed viewer application for OSPRay showcasing more advanced features
C++
2
star
73

wall_art

Generate nice wallpapers from images
C++
2
star
74

sdl2webgpu

A function to easily get a WebGPU context for SDL2 on Web & Native
CMake
2
star
75

vis17-particles-ospray

Particle Rendering Samples in OSPRay for the VIS17 Particle Rendering Tutorial
C++
2
star
76

ospray-vive

C
2
star
77

parallel-rsync

Script for parallelizing rsync transfers on large directories
Python
2
star
78

module_lidar_importer

A LiDAR importer for OSPRay's scenegraph
C++
2
star
79

module_pidx

PIDX rendering sample app for OSPRay
C++
2
star
80

SSE-Fiddle

Messing around with making a very basic SSE math library for 4 vectors and 4x4 matrices
C
2
star
81

fast-kd

A k-d tree builder which is pretty fast
C++
2
star
82

ExaMPM-libbat

C++
2
star
83

webgl-df

WebGL Distance Field Renderer
JavaScript
1
star
84

particle-lasso

Utilities for lassoing particle data
C++
1
star
85

arxivify

A utility script to make it easier to build the flattened tex/assets layout that arXiv takes for uploads.
Python
1
star
86

module_openvr

OpenVR Module for OSPRay. View 360 panorama images in VR
C
1
star
87

rvk

A library for easily building remote rendering visualization applications
C++
1
star
88

OpenGL-Wrapper

A simple OpenGL Wrapper/Learning project I'm working on
C++
1
star
89

microGL

A micro OpenGL-like rasterizer
C
1
star
90

libIS

libIS is an in situ data management layer for easily using or prototyping in transit visualization
C++
1
star
91

ispc.vim

ISPC syntax and indentation configuration for vim
Vim Script
1
star
92

module_pidx_particle

PIDX Particle Rendering with OSPRay
C++
1
star
93

blender_export_crts

A ChameleonRT Scene Exporter for Blender
Python
1
star
94

tbb_scan_example

Example of using TBB parallel scan for inclusive/exclusive scans and marching cubes
C++
1
star
95

ospray_senpai

OSPRay viewer for use with SENSEI simulations and libIS, from the ISAV18 paper
C++
1
star
96

Deferred-Rendering

Playing around with making a deferred renderer
C++
1
star
97

webgpu-bcmc-data-generator

Convert RAW files or generate synthetic data for BCMC
C++
1
star
98

arcball.js

A Shoemake Arcball camera in Javascript
JavaScript
1
star