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
- Physicallly-Based-Rendering(Cook-Torrance)
Tiny renderer is available in Windows, Linux and MacOSX now.
You can run with cargo
.
cargo run --release [shader] [path]
cargo run --release pbr [path] [spp]
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 .gltf/.obj/.mtl
and texture image(.jpg/.png
) file.
It means they should be in same directory. PBR will try to load .gltf
and others will try to load .obj
.
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
cornell-box
Don't forget --release
flag because of its poor performance.
- Rotate camera:
W/S/A/D
- Rotate light:
I/K/J/L
- Zoom camera:
↑/↓