A raytracer in Rust. Compiles on Rust stable > 1.5.
Gallery
Gallery repository
Assets repository
-
Clone the project.
--recursive
clones most sample models and textures into the project directory as well.git clone --recursive https://github.com/gyng/rust-raytracer.git
-
Compile
cargo build --release
-
Edit
sample-config.json
if you wish to render a scene besides the default, or if you wish to tweak the renderer parameters -
Run the compiled program, passing the render configuration as an argument. If rendering a provided scene, run the binary in the project root so it can find the models and textures.
./main sample-config.json
or alternatively to compile and run in one single command
cargo run --release sample-config.json
- To update (assets) submodules only:
git submodule foreach git pull
- To convert frames into a video
ffmpeg -i test%06d.ppm -b 2000k out.webm
- Scenes are created in
./myscene/
. To hook up a scene, add it to./myscene/mod.rs
andget_camera_and_scene(&SceneConfig)
inmain.rs
.
These should use 30deg fov for squares and 45deg fov for 16:9.
- box
- bunny
- cow
- easing (0s-10s animation)
- fresnel (0s-10s animation)
- lucy
- sibenik (0s-7s animation)
- sphere (0s-10s animation)
- sponza (45deg fov for a square; 67.5deg for 16:9)
- teapot
- heptoroid-white
- heptoroid-shiny
- heptoroid-refractive
- tachikoma
- Reflections
- Refractions
- Multi-threading
- Soft shadows
- Supersampling
- Cook-Torrance, Phong materials
- Sphere, plane, triangle primitives
- Point, sphere lights
- Unoptimised glossy reflections
- Limited OBJ model and mesh support
- Mesh transformations (4x4 matrices)
- Basic spatial partitioning (octree)
- Basic textures (checker, uv, image)
- Skybox (cubemap)
- Camera animation with Bézier easing
- Scene description
- Caustics/global illumination (progress stalled on
photon-trace
branch)