/rusterizer

A weekend project. This time for sure.

Primary LanguageRustMIT LicenseMIT

ya rusterizer

I am sure this is neither the first nor last rusterizer you will see

A weekend project by a weekend rustacean. Nothing to see here yet.

Building

This is edition = "2018", so you need a rustc version that can compile that. At the time of writing this beta already works.

Run examples with:

  • cargo run --release --example window <model path> <texture path>
  • cargo run --release --example terminal <model path> <texture path>

(you need to get the assets yourself, e.g. in the tinyrenderer repo)

Roadmap

Short term

  • Take inspiration from euc
    • interpolate doesn't need to take in the barycentric coordinates as a Vec3
    • Pixel as associated type
    • A generic render target
impl ShaderProgram for SimpleProgram {
    type Attribute = [f32; 3];
    type Varying = ();
    type Pixel = [f32; 4];

    fn vert(&self) -> ([f32; 4], Self::Varying) {
        // ...
    }

    fn frag(&self, varying: &Self::Varying) -> Self::Pixel {
        // ...
    }
}
  • proc macro derive for Smooth
  • polish glam interop (From/Into impls)
    • float normalization in From/Into impls?
    • float normalization in image?
  • triangle clipping

Long term

  • postprocessing example
  • geometry shaders
  • think about data parallelism

Prior art

Thanks to Dmitry Sokolov for producing an excellent guide on building software rasterizers.

Also thanks to the image crate developers for inspiring the image implementation used here.