agourlay / ray-tracer

Implementation in Rust of "The Ray Tracer Challenge" book.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ray-tracer

Build

Implementation in Rust of a ray tracer following The Ray Tracer Challenge book.

The renderer is a ray tracer, which means it simulates the physics of light by tracing the path of light rays around your scene. 
Each exciting chapter presents a bite-sized piece of the puzzle, building on earlier chapters and setting the stage for later ones.
Requirements are given language-agnostically; it’s up to you to translate them into tests and code using whatever language you prefer.
When the project is complete, you’ll look back and realize you’ve built an entire system test-first!

Status

  • Chapter 1 - Tuples, Points, and Vectors
  • Chapter 2 - Drawing on a Canvas
  • Chapter 3 - Matrices
  • Chapter 4 - Matrix Transformations
  • Chapter 5 - Ray-Sphere Intersections
  • Chapter 6 - Light and Shading
  • Chapter 7 - Making a Scene
  • Chapter 8 - Shadows
  • Chapter 9 - Planes
  • Chapter 10 - Patterns
  • Chapter 11 - Reflection and Refraction
  • Chapter 12 - Cubes
  • Chapter 13 - Cylinders
  • Chapter 14 - Groups
  • Chapter 15 - Triangles
  • Chapter 16 - Constructive Solid Geometry (CSG)
  • Chapter 17 - Next Steps
  • A1 - Rendering the Cover Image

Examples

  • chapter 10 on patterns. alt text

Hacking

Performance profiling

The code can be profiled to remove bottlenecks and keep the rendering fast as features are added.

cargo install flamegraph to install https://github.com/flamegraph-rs/flamegraph

then inside the project directory we can profile cargo run --release by running cargo flamegraph

Latest flamegraph.

Todos and ideas

todo

About

Implementation in Rust of "The Ray Tracer Challenge" book.


Languages

Language:Rust 100.0%