A final project for Stanford's CS248 http://cs248.stanford.edu/winter20.
This 1024x1024 image with about 2.3 million triangles was rendered with 16 samples per pixel in about 39 seconds (generating the BVH tree took about 27 seconds) on a 4 core i5-6600K CPU. Thanks to the Stanford Computer Graphics Laboratory for providing these models at https://graphics.stanford.edu/data/3Dscanrep.
Use cargo
to build, test, and run the code. For optimal performace, use the release build. The following command will render a basic scene to out.png with size 1024x1024.
#cargo run --release -- <args>
cargo run --release -- -f out.png -w 1024
To print useful timing information, set the environment variable RUST_LOG
.
RUST_LOG=debug cargo run --release
cargo test
- Move structs into their own files
- Lights
- Ambient
- Point
- Cone
- Directional
- Shadows
- Soft shadows
- Correct shadows from transparent surfaces
- Objects
- Sphere
- Plane
- Triangle
- Triangle Meshes
- BVH
- Parallelize
- BVH
- Materials
- Flat
- Phong
- Reflective
- Transparent
- Texture
- Super sample texture
- Tracing
- Anti-aliasing
- Focus blur
- Threads