• Stars
    star
    513
  • Rank 86,178 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created almost 10 years ago
  • Updated over 3 years ago

Reviews

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

Repository Details

A toy ray tracer in Rust

tray_rust - A Toy Ray Tracer in Rust

tray_rust is a toy physically based ray tracer built off of the techniques discussed in Physically Based Rendering. It began life as a port of tray to Rust to check out the language but has surpassed it in a few ways. The renderer is currently capable of path tracing, supports triangle meshes (MTL support coming soon), and various physically based material models (including measured data from the MERL BRDF Database). tray_rust also supports rigid body animation along B-spline paths and distributed rendering.

Build Status

Running

Running and passing --help or -h will print out options you can pass to the renderer which are documented in the help. For the more complicated use cases I hope to do some write ups and guides on how to use them (e.g. distributed rendering, animation) but this may take a while. I strongly recommend running the release build as the debug version will be very slow.

Building Your Own Scenes

To position and animate objects, the camera and so on the Blender plugin is the easiest to use. However the plugin is still in development and missing some features like setting materials, changing light properties and such so you'll still currently need to do those by hand in the exported JSON file. For materials take a look at the materials documentation for lights you'll likely just want to change the emission color which is an RGB color plus a strength term.

Start at the documentation for the scene module, there are also a few example scenes included but not all the models are provided. From a clean git clone you should be able to run cornell_box.json and smallpt.json. I plan to add some more simple scenes that show usage of other features like animation to provide examples. The rigid body animation feature is relatively new though so I haven't had time to document it properly yet.

Documentation

Documentation can be found on the project site.

TODO

Sample Renders

In the samples the Buddha, Dragon, Bunny and Lucy statue are from The Stanford Scanning Repository. The Rust logo model was made by Nylithius on BlenderArtists. The Utah teapot used is from Morgan McGuire's page and the monkey head is Blender's Suzanne. I've made minor tweaks to some of the models so for convenience you can find versions that can be easily loaded into the sample scenes here, though the cube model for the Cornell box scene is included. The materials on the Rust logo, Buddha, Dragon and Lucy are from the MERL BRDF Database. Models for running the scenes and links to model sources can be found here.

Render times are formatted as hh:mm:ss and were measured using 144 threads on a machine with four Xeon E7-8890 v3 CPUs. The machine is an early/engineering sample from Intel so your results may differ, but massive thanks to Intel for the hardware! Some older renders are shown as well without timing since they were run on a different machine.

Some more sample renders can be found here. I've also used tray_rust for the past two years at Utah's Teapot Rendering Competition, view my animations for 2015 and 2016. The latter was made using the Blender plugin for modeling and contains more complex motion and sequences.

Model gallery

1920x1080, 4096 samples/pixel. Rendering: 00:43:36.45.

Rust Logo with friends, disk

1920x1080, 4096 samples/pixel. Rendering: 00:49:33.514.

More Repositories

1

ChameleonRT

An example path tracer that runs on multiple ray tracing backends (Embree/DXR/OptiX/Vulkan/Metal/OSPRay)
C++
599
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