Skip to content

scott223/raytracer

Repository files navigation

GitHub CI Status dependency status lines count

Raytracer

Simple Raytracer for simple 3D scenes, made in Rust. Objective is to learn Rust, not make a very good raytracer.

Ray tracing features

  • Monte Carlo raytracer with adaptive sampling (based on z-test confidence interval)
  • Anti aliasing using Sobol sequence and Mitchell Netravali filter
  • Weigthed importance sampling using Probability Distribution Functions and attractors (e.g. lights)
  • Various primitives (triangle, quad, sphere)
  • Various materials (Lambertian, Metal, Glass, ...)
  • Bounded Hierarchy Volumes (BHV) tree, constructed using Surface Area Heuristic (SAH), to accelerate intersection tracing
  • Parallel multi-threaded rendering using Rayon
  • Gamma correction
  • Configurable depth of focus
  • Scene and configuration input from JSON
  • ...

Render example Render of different objects (cube, sphere, .obj file import (100k triangles) and materials (lambertian, glass, fuzzy metal). This render of 1200x1200 pixels with 2000 samples per pixel took about 30 minutes to complete on MacBook Air M2

todo's

  • BRDF materials

Rust learnings applied

  • modules, imports, external crates
  • ownership/references/borrow, explicit lifetimes
  • methods, enums, structs
  • generic methods
  • traits
  • basic iterators, match statement
  • Result, Error, Option
  • reading files, saving files
  • logging, .env
  • tests, benchmarking, flamegraph
  • VSCode debugger, breakpoints and memory inspector
  • Git(hub)

Credits / references

License

Licensed under MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you shall be licensed as above, without any additional terms or conditions.

About

Simple 3D raytracer written in Rust

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages