Skip to content

ema2159/tinyraytracer_rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tinyraytracer_rs

This repo consists of a Rust implementation of the tinyraytracer walkthrough by professor Dmitry V. Sokolov. For a tinyrenderer Rust implementation, check the tinyrenderer_rs repo.

Dependencies:

  • image 0.24.5: Image loading and manipulation
  • piston_window 1.127.0: Window to display rendered frames
  • obj-rs 0.6: To retrieve information from .obj files
  • nalgebra 0.31.4: For vector and matrix calculations

Usage

To run, just clone any of the branches and execute cargo run --release. If the branch requires some assets, execute:

cargo run --release <assets directory>

where <assets directory> is the directory in which the corresponding assets (like the env map or obj model) are. For example, to run Step 10a you must clone the branch and execute:

cargo run --release assets/

At the moment, if you want to use other assets, you would have to modify the respective assets names in main.

Steps

Step 1: Display image on window

Write to an image buffer and render it in a window.

Branch: Step_1

Preview: Step 1 image

Step 2: Ray tracing

Basic ray tracing for single sphere.

Branch: Step_2

Preview: Step 2 image

Step 3: Add more spheres

Add more spheres. Add basic materials support.

Branch: Step_3

Preview: Step 3 image

Step 4: Diffuse lighting

Add diffuse lighting to scene objects.

Branch: Step_4

Preview: Step 4 image

Step 5: Specular lighting

Add specular lighting to scene objects.

Branch: Step_5

Preview: Step 5 image

Step 6: Shadows

Add shadows computation to scene objects.

Branch: Step_6

Preview: Step 6 image

Step 7: Reflections

Add reflections computation to scene objects.

Branch: Step_7

Preview: Step 7 image

Step 8: Refractions

Add refractions computation to scene objects.

Branch: Step_8

Preview: Step 8 image

Step 9: Rectangle objects

Add finite and infinite plane primitives support.

Branch: Step_9

Preview: Step 9 image

Step 10a: Environment mapping

Add environment mapping support.

Branch: Step_10a

Preview: Step 10a image

Step 10b: Obj models support

Add support for triangle primitives. Use that to render .obj models.

Branch: Step_10b

Preview: Step 10b image