Skip to content

A toy software renderer for learning Computer Graphics written in Rust.

License

Notifications You must be signed in to change notification settings

arrayJY/tiny-renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tiny Renderer

A toy software renderer for learning Computer Graphics written in Rust.

Features

  • Homogeneous clipping
  • Back-face culling
  • Perspective correct interpolation
  • Depth testing
  • Phong shading
  • Orbital camera controls
  • Physicallly-Based-Rendering(Cook-Torrance)

Usage

Tiny renderer is available in Windows, Linux and MacOSX now.

Launch

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 shader
  • color: 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.

Controls

  • Rotate camera: W/S/A/D
  • Rotate light: I/K/J/L
  • Zoom camera: ↑/↓

Screenshots

screenshot command
cargo run --release texture static/earth
cargo run --release z static/cube
cargo run --release phong-texture static/spot
cargo run --release pbr static/cornell-box 512
cargo run --release pbr static/silver-mirror 512
cargo run --release pbr static/bunny 512

License

MIT

About

A toy software renderer for learning Computer Graphics written in Rust.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages