Skip to content

artogahr/ray-tracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust Ray Tracer

A ray tracer implemented in Rust, based on Peter Shirley's "Ray Tracing in One Weekend" C++ series. It features depth of field and a basic material system.

Features

  • Basic Ray Tracing: Renders scenes with spheres and planes.
  • Materials: Supports diffuse, metal, and dielectric materials.
  • Depth of Field: Simulates camera blur using a defocus disk.

Installation and Usage

  1. Clone the repository:

    git clone https://github.com/yourusername/rust-ray-tracer.git
    cd rust-ray-tracer
  2. Build the project:

    cargo build --release
  3. Render an image and save it to output.ppm:

    cargo run --release > output.ppm

Then open the output file with your favorite image editor. You can use an online PPM viewer if that doesn't work.

This below image took 5m15s to be rendered on a Ryzen 5600 @ 3.7Ghz 6C12T, using Rayon for multi-threading:

Spheres

The same image took 38m46s to render using a single thread, and no performance optimizations.

Next Steps

  • Performance Profiling, identify chokepoints - Done
  • CPU Multithreading - Done
  • GPU Multithreading - Probably won't do, not realistically feasible for this

Based on book version:
Ray Tracing in One Weekend
Version 4.0.0-alpha.2, 2024-04-07

About

A Rust implementation of RayTracingInOneWeekend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages