Skip to content
a toy raytracer in rust
Rust
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
benches
examples
src
.gitignore
Cargo.lock
Cargo.toml
README.md
earth.png
rustfmt.toml
todo.md

README.md

Ray

A toy unbiased path tracer made by following the excellent tutorials: "Ray Tracing in One Weekend" and "Ray Tracing: the Next Week".

Examples

Cornell Box Ray Tracing In One Weekend Ray Tracing: The Next Week

If I do more renders I'll put them here.

Features

  • Geometric primatives: sphere, rectangle, and rectancular prism
  • 3D Mesh support (using .obj files)
  • Materials: diffuse, specular, dielectric, isotropic, and emissive
  • Textures: constant, image based (including hdr), and procedural (checkered/perlin noise/gradient)
  • Acceleration using bounded volume heirarchy and parallelization
  • Global illumination using radiant textured world sphere and emmisive entities
  • Camera with depth of field

See the todo file for stuff that I'm considering implementing in the future.

Non-Features

These are techniques or features I've given up on implementing due to difficulty or lack of interest.

  • Motion blur
  • Animation
  • Importance sampling
  • GPU acceleration
  • Networked/distributed rendering
  • Tone mapping
  • Non-code scene description

Resources

  • Real Time Rendering hosts a bunch of free ray tracing books including the "in One Weekend" series. They also link to "Physically Based Rendering" which is like the bible of raytracing (haven't read it myself but everyone recommends it) and Abrash's Black Book which has nothing to do with raytracing but is full of really cool optimizations for graphics code.
  • Peter Shirley's blog is a great companion to his books. It goes more in depth on the topics covered as well as showing off more modern ray tracing techniques.
  • Scratchapixel is my favorite comprehensive resource for computer graphics basics. It covers many techniques and algorithms used in raytracing with code samples and visualizations.
  • In terms of inspiration, I've always loved minimalist graphics programs like the business card raytracer, smallpt, and donut.c. I also watch a youtube series called Two Minute Papers which gives brief explanations of academic papers mostly in the fields of computer graphics and machine learning. The guy who runs it also happens to teach a college level raytracing course which I quite enjoyed the lectures from.
  • I've mostly stayed away from reading academic papers or following real college level graphics courses, but there are a few that I've skimmed and gotten something out of. These inlcude UT Austin's graphics course which had a good lesson on adaptive super sampling, an MIT OCW graphics course, and the University of Tartu's online resources.
  • I've looked at dozens of blog posts and repos from others building their own ray tracers varrying in complexity from just as "toy" as mine to large scale projects. They've been a great source of inspiration, as well as being good mini-lessons for raytracing problems like generating random points in a sphere. In no particular order here are some that I read while working on mine:
    • Will Usher made a bunch of awesome graphics projects. In particular I really like tray_rust
    • Seena Burns followed Ri1W and the next week in rust
    • Arshia Mufti followed Ri1W in rust
    • Brook Heisler wrote a GPU accelerated path tracer in rust
    • bitshifter followed Ri1W in rust and went on to optimize the heck out of it
    • Aras Pranckevičius wrote a few raytracers using different languages and technologies (including WASM!) and they have a bunch of posts on general graphics stuff
    • demofox has written dozens of informative posts on ray tracing techniques
    • Kevin Beason wrote a fairly advanced raytracer and has great doccumentation of their progress
  • The MERL BDRF database, HDRI Haven, and texturify are great free resources for texturing and environment mapping.
  • This is a great comparison of popular 3d file formats.
  • Adam Perry wrote a great walkthrough for performance profiling rust with flamegraphs.
You can’t perform that action at this time.