#anti-aliasing #gfx

gfx_smaa

A library for post process antialiasing using SMAA

3 unstable releases

Uses old Rust 2015

0.2.1 Oct 5, 2018
0.2.0 Aug 6, 2018
0.1.0 Jan 28, 2018

#150 in Rendering

MIT license

1MB
16K SLoC

gfx_smaa crates.io docs.rs Travis

A library for post process antialiasing for the gfx-rs graphics API, based on the SMAA reference implementation. Currently only works with OpenGL 3+, but support for other graphics APIs is planned.

Example

// create window
let mut window: PistonWindow = WindowSettings::new("SMAA", (640, 480)).build().unwrap();

// create target
let mut target = SmaaTarget::<_>::new(&mut window.factory,
                                      window.output_color.clone(),
                                      640, 480).unwrap();

// main loop
while let Some(e) = window.next() {
    window.draw_3d(&e, |window| {
        // clear depth and color buffers.
        window.encoder.clear_depth(&target.output_depth(), 1.0);
        window.encoder.clear(&target.output_color(), [0.0, 0.0, 0.0, 1.0]);

        // Render the scene.
        ...

        // Perform actual antialiasing operation and write the result to the screen.
        target.resolve(&mut window.encoder);
     });
}

Dependencies

~2.5MB
~59K SLoC