Skip to content

shouya/raster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Toy rasterizer

This project is my attempt to learn rendering technique by crafting a 3d rasterizer from scratch.

The program is an interactive GUI application capable of rendering model files exported in Wavefront format (.obj). You can explore the various rasterizer options by interacting with the GUI.

The rasterizer runs purely on CPU, and no parallelism is added so far. Although I’ve employed various techniques to improve performance, the rendering is still too slow for any practical purpose.

You may also be interested in my other computer graphics project - a ray-tracer written from scratch: ray.

Features

Supported features

Please note that not all features can be explored via the GUI.

  • Lamp (color and position)
    • Multiple lamp support
  • Mesh
    • Single/double-faced
    • World transformation
    • Optionally cast shadow
  • Shader
    • Preset shaders: PureColor, DiffuseShader, SpecularShader, SimpleMaterial
    • Custom shader via trait Shader
  • Basic shadow support
  • Texture
    • Bi-linear filter
    • Nearest-pixel filter
  • Rasterizer
    • Rasterization and shading pass separation
    • Multiple render modes
      • Shaded (normal)
      • Wireframe
      • Clipped triangles visualization
      • Shadow volume visualization
  • Wavefront model (.obj) loading
    • Material support (.mtl)
    • Color texture support
    • Bump map support
    • Multi object/multi material in a single obj file

UI features

See the screenshot.

./static/ui.png?raw=true

Camera controls:

  • Rotation: dragging (left mouse button)
  • Pan: dragging (middle mouse button)
  • Zoom: scroll wheel

Planned features

Building

  1. Clone this repository
  2. Run cargo run --release

The UI is based on egui_glium. Make sure you have all its dependencies installed.

References

Since I didn’t intentionally collect articles helpful to me until some point, please be aware that the list here is incomplete.

License

GPL-2.0

About

Toy 3d rasterizer from scratch

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages