This project is a software-based 3d renderer implemented entirely in C99. It mimics the functionality of a modern graphics api such as OpenGL, but runs fully on the CPU. The renderer is built around a modular architecture, focusing on flexibility and ease of integration.
“The Lighthouse” by Cotman Sam (used under CC BY 4.0). 15ㅤㅤㅤㅤ,000 triangles rendered in real time at ~60FPS on the AMD Ryzen 7 5800X
- Complete 3d rendering pipeline: from model import to final pixel output, every stage of the pipeline is implemented in software
- Cross-platform support: includes a lightweight platform layer compatible with both windows (
windows.h) and linux (x11)
Linux support is currently only partial due to hardware limitations and time constraints
-
Custom asset loaders: manually written parsers for
.objand.mtlformats -
Minimal external dependencies: uses only platform libraries for window management and
stb_imagefor texture loading -
Optimized rasterization:
- perspective-correct interpolation for vertex attributes (color, uv coordinates)
- back-face culling for performance
- depth buffering (
z-buffer) for proper occlusion
-
Shading and texture mapping:
- supports gouraud and flat shading
- textured and non-textured rendering modes
- bilinear and nearest-neighbor texture sampling
-
3d math library:
- custom implementation for vector and matrix operations
- left-handed coordinate system
- column-major matrix layout for transformations
-
Language: c99 (no external frameworks)
-
Rendering core:
- cpu-driven rasterizer
- dedicated framebuffers for color and depth
-
Implemented graphics pipeline stages:
- model & view transformation: converts object-space vertices into world and camera space
- projection: applies perspective projection to map 3d coordinates into 2d screen space
- clipping: clips primitives against the view frustum boundaries
- rasterization: converts triangles into pixel fragments
- shading & texturing: applies color interpolation or texture sampling per pixel
-
Dependencies:
stb_image.hfor texture loadingwindows.h(on windows) orx11/xlib.h(on linux) for windowing and input handling
the project includes a makefile for straightforward compilation.
-
clone the repository:
git clone https://github.com/auria-dev/software-renderer.git cd software-renderer -
build the project:
-
on linux, ensure x11 development headers are installed:
# debian/ubuntu sudo apt-get install libx11-dev # arch sudo pacman -S libx11 # nix nix-shell -p libX11 # void sudo xbps-install -S libX11-devel
-
compile the source using:
make
-
-
run the application:
./renderer
-
w, a, s, d: move camera forward, left, backward, and right
-
space: move camera up
-
left shift: move camera down
-
arrow keys: rotate camera
-
escape: exit the application



