A toy software renderer for learning Computer Graphics written in Rust.
- Homogeneous clipping
- Back-face culling
- Perspective correct interpolation
- Depth testing
- Phong shading
- Orbital camera controls
Tiny renderer is available in Windows, Linux and MacOSX now.
You can run with cargo
.
cargo run --release [shader] [path]
shader
is the name of fragment shader.
Available shaders:
z
: Depth shadercolor
: Color shader.texture
: Texture mapping shader.phong-color
: Color shader with Phong shading.phong-texture
: Texture shader with Phong shading.
path
is the the path without extension to .obj/.mtl
and texture image(.jpg/.png
) file.
It means they should be in same directory.
For example, you can run just like:
cargo run --release color static/cube
It will run the renderer with static/cube.obj
.
There are some simple models in static
directory.
cube
cone
multi_models
earth
earth_good
spot
Don't forget --release
flag because of its poor performance.
- Rotate camera:
W/S/A/D
- Rotate light:
I/K/J/L
- Zoom camera:
↑/↓
screenshot | command |
---|---|
cargo run --release texture static/earth |
|
cargo run --release z static/cube |
|
cargo run --release phong-texture static/spot |
|