A custom 3D wireframe renderer built from scratch in Rust, implementing a complete graphics pipeline entirely in software. It translates and rotates 3D coordinates, projects them onto a 2D screen surface, and writes the result directly to a raw pixel buffer displayed via minifb. No OpenGL, no Vulkan, no GPU acceleration. Everything runs on the CPU.
The renderer includes several built in capabilities.
- Custom Math: The engine handles all math and transformations internally. It converts 3D world coordinates into screen space using perspective projection.
- Software Rasterization: It features a custom line drawing function based on simple linear interpolation (DDA algorithm) to connect points and form wireframe faces. It writes these pixels directly into a flat array buffer.
- Procedural Generation: You can generate complex procedural shapes with the built in math functions. It can build a torus knot by calculating tangents and normals to extrude a shape along a mathematical curve.
- Model Loading: The project provides an OBJ file parser to load custom 3D models. It reads vertices and face data from the text file and automatically centers the bounding box around the origin.
You need to have Rust and Cargo installed to run the project.
First clone the repository to your local machine.
git clone https://github.com/ecstras-lab/Tiny-Wireframe-Renderer.git
cd Tiny-Wireframe-RendererThen compile and run the code.
cargo runThe window will open and display a rotating torus knot.
Press ESC to close the window and exit the application.
You can load custom OBJ files by changing the code. Swap the torus knot generator with the model loader.
// in main.rs
let (vertices, faces) = obj::load_obj("your_model_path.obj");You must adjust the camera distance variable according to your model size. A higher value moves the camera farther away. The renderer will glitch out if the distance is too small for the model.
