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
Step 2: Ray tracing
Basic ray tracing for single sphere.
Branch: Step_2
Step 3: Add more spheres
Add more spheres. Add basic materials support.
Branch: Step_3
Step 4: Diffuse lighting
Add diffuse lighting to scene objects.
Branch: Step_4
Step 5: Specular lighting
Add specular lighting to scene objects.
Branch: Step_5
Step 6: Shadows
Add shadows computation to scene objects.
Branch: Step_6
Step 7: Reflections
Add reflections computation to scene objects.
Branch: Step_7
Step 8: Reflections
Add refractions computation to scene objects.
Branch: Step_8
Step 9: Rectangle objects
Add finite and infinite plane primitives support.
Branch: Step_9
Step 10a: Environment mapping
Add environment mapping support.
Branch: Step_10a
Step 10b: Obj models support
Add support for triangle primitives. Use that to render .obj models.
Branch: Step_10b