Skip to content

A simple ray tracer with realistic light scattering.

License

Notifications You must be signed in to change notification settings

thecodeboss/raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raytracer

Example generated image

I got bored one weekend and wanted to try some different techniques for raytracing than those I previously used in Fantasi. In this project, rays scatter off of surfaces they hit stochastically, whereas in Fantasi rays followed a deterministic path, computing lighting using some approximations.

It supports:

  • Spheres
  • Diffuse (Lambertian) materials
  • Metallic materials
  • Dielectric materials (ie. glass)
  • Diffuse light emitting materials
  • Camera transformations
  • Camera field-of-view setting
  • Camera aperture setting (ie. depth of field)
  • Antialiasing
  • PPM Image format
  • Multi-threaded sampling

Building

Currently this only supports Linux and macOS based systems. You'll need a version of g++ that supports C++17, as well as the boost libraries. On Linux, run:

sudo apt-get install build-essentials libboost-all-dev

On macOS, run:

brew install boost

Then just run make release and it should output a binary to ./build/release/apps/raytracer.

Acknowledgements

This project was largely inspired by the excellent book Ray Tracing in One Weekend by Peter Shirley. It's well-written and easy to follow along. I made many of my own modifications along the way, making use of techniques from Scratchapixel and the book Physically Based Rendering: From Theory to Implementation by Matt Pharr et. al.

License

Code in this repository is released under the MIT License - see the LICENSE file.

About

A simple ray tracer with realistic light scattering.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published