[go: up one dir, main page]

Skip to content

Raytracing and photon-mapping renderer written from scratch in 100% pure Rust

Notifications You must be signed in to change notification settings

giorgi-o/rust-raytracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Raytracing from scratch

This is a raytracer built from scratch in pure Rust, capable of rendering any scene in either raytracing mode or using Jensen's advanced Photon Mapping technique. It doesn't use any libraries, not even OpenGL.

Demo

Features

  • Directional, positional and ambient lights
  • Reflection, refraction and transparency using Fresnel equations
  • Quadratic surfaces and shapes (Quadrics)
  • Constructive Solid Geometry (CSG)
  • Texturing for planar, spherical and cuboid surfaces including normal maps
  • Jensen Photon mapping, including caustics

How to run

With Rust installed and FFmpeg in your PATH, simply run cargo run --release.

By default, it will render the scene in scene2.txt. You can specify another scene to render using cargo run --release -- scene.txt for example.

For simple scenes, the number of photons shot can be reduced in src/environments/photon_scene.rs to speed up the render. Inversely, the number can be increased for more realistic lighting.

FFmpeg is used to convert textures from PNG to PPM, and the output from PPM to PNG.

About

Raytracing and photon-mapping renderer written from scratch in 100% pure Rust

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages