10 releases

0.5.3 Mar 9, 2021
0.5.2 Nov 19, 2020
0.5.0 Apr 12, 2020
0.4.3 Jan 17, 2020
0.1.0 Feb 9, 2019

#386 in Graphics APIs

Download history 189/week @ 2023-12-17 87/week @ 2023-12-24 112/week @ 2023-12-31 196/week @ 2024-01-07 189/week @ 2024-01-14 162/week @ 2024-01-21 179/week @ 2024-01-28 142/week @ 2024-02-04 257/week @ 2024-02-11 541/week @ 2024-02-18 524/week @ 2024-02-25 194/week @ 2024-03-03 149/week @ 2024-03-10 168/week @ 2024-03-17 154/week @ 2024-03-24 195/week @ 2024-03-31

683 downloads per month
Used in blockish

Apache-2.0 AND MIT

522 lines


crates.io crates.io

Utah teapot, rendered with Euc


struct Example;

impl Pipeline for Example {
    type Vertex = [f32; 2];
    type VsOut = ();
    type Pixel = [u8; 4];

    // Vertex shader
    fn vert(&self, pos: &Self::Vertex) -> ([f32; 3], Self::VsOut) {
        ([pos[0], pos[1], 0.0], ())

    // Fragment shader
    fn frag(&self, _: &Self::VsOut) -> Self::Pixel {
        [255, 0, 0, 255] // Red

fn main() {
    let mut color = Buffer2d::new([640, 480], [0; 4]);
    let mut depth = Buffer2d::new([640, 480], 1.0);

    Example.draw::<Triangles<_>, _>(
            [-1.0, -1.0],
            [ 1.0, -1.0],
            [ 0.0,  1.0],
        &mut color,
        &mut depth,

See examples/ for more code examples.

What is euc?

euc is a versatile, simple to use crate that allows 3D rendering on the CPU. It has a portable, compact design that makes it perfect for prototyping ideas, unit testing, or even simple realtime applications. euc is currently under active development.


  • Modern graphics APIs are complex, verbose beasts. Rendering with the CPU means less complexity, less boilerplate and less verbosity: perfect for testing ideas.

  • Modern CPUs are fast enough to make simple 3D programs run at reasonable speeds (although they are of course no match for GPUs). It's possible to write surprisingly complex realtime 3D software with the CPU only.

  • Not requiring a GPU interface means that euc is incredibly portable. As a result, euc is no_std (if you have a nightly compiler).

  • euc has consistent cross-platform behaviour and doesn't require a GPU to run. This makes it perfect for use as a unit testing tool.

  • Running on the CPU allows a more dynamic approach to data access. For applications in which performance is less of a concern, euc lowers the barrier of low-level 3D development and allows for more novel approaches to graphics rendering to be realised.

Coordinate System

Where possible, euc tries to use a coordinate system similar in nature to OpenGL. If you're used to OpenGL, you'll have no trouble working with euc.

Release Mode

Cargo, by default, compiles Rust code in debug mode. In this mode, very few optimisations are made upon the code, and as a result the performance of software rendering tends to suffer. To experience this project with good performance, make sure to compile with the --release flag.


euc can be compiled on platforms that lack standard library support. This makes it ideal for rendering 3D graphics on embedded devices. You can enable no_std support by disabling the default features and enabling the libm feature in your Cargo.toml file like so:

euc = { version = "x.y.z", default-features = false, features = ["libm"] }


  • Support programmable shaders written in Rust

  • Support common pipeline features such as texture samplers, multiple rendering passes, uniform data, etc.

  • Simple, elegant interface that scales well

  • Correctness


  • Extreme optimisation (although obvious low-hanging fruit will be picked)

  • Compliance/compatibility with an existing API (i.e: OpenGL)


euc is distributed under either of:

at the disgression of the user.


~17K SLoC