/rayn

A small path tracing renderer written in Rust.

Primary LanguageRustOtherNOASSERTION

rayn

This is a CPU-based path tracing renderer focused on rendering SDFs, specifically fractals. It was originally based on the book "Ray tracing in one weekend" by Peter Shirley, which I heartily recommend, though it has now evolved into a structure of my own design, taking hints from that, pbrt, which is also an excellent reference, and research from NVIDIA on wavefront pathtracing for taking advantage of SIMD.

Features

  • Architected to use 128-wide SIMD to full extent with the help of ultraviolet, and in the future perhaps 256 or 512 as well.
  • Physical light transport algorithm
  • Multiple-bounce indirect lighting/global illumination
  • Importance sampling (soon multiple importance sampling)
  • Next Event Estimation / Direct light sampling
  • Depth of field
  • Arbitrary animation and time-sampled motion blur
  • Signed distance field rendering through leveraging sdfu
  • Homogeneous volumetrics with extinction and single scattering with isotropic media

Demo images

All demo images in this repository are licensed under the CC BY-NC-ND license which essentially means you are free to use them for non-commercial purposes so long as you:

1. Credit me (my name, Gray Olson, and a link to my website, https://grayolson.me/)

2. Do not modify them

CC BY-NC-ND License Badge

If you wish to use them for commercial purposes, contact me and we can work out a license.

demo7 demo1 Full 8k resolution image of this render available here.

How to use it

Building

First, install Rust. Then, clone or download this repo (green "Code" button on GitHub). Finally, open a shell prompt and change to this repository's directory (if you're not sure how to do this, see this article). Then, run

$ cargo run --release

This will render an image and place it in a folder called renders inside the folder this repo is in.

Playing with the scene

With your favorite code editor (I recommend VSCode with the rust-analyzer plugin), open the src/setup.rs file.

Here you can change many settings including the resolution of the output image, the number of indirect lighting bounces, the number of raymarching steps on each path, the number of total samples to take, and the setup of the whole scene. Feel free to play with all these numbers and see what they do. Just run cargo run --release each time you make a change to render a new image. There are some comments in that file to help you get started on things you can play around with.

More demo images

demo2 demo3 demo4 demo5 demo6