CPUEngine
February 23, 2026 · View on GitHub
A real-time 3D graphics engine that runs entirely on the CPU — no GPU required.
Built to learn computer graphics at the lowest possible level, then push performance as far as it can go using modern SIMD vectorization (AVX2/FMA on x86, NEON on ARM).

Features
Rendering
- Software rasterizer with perspective-correct interpolation
- Z-buffer depth testing
- Frustum culling (bounding sphere)
- Wireframe and solid rendering modes
- Runtime render resolution scaling (270–1080) with nearest-neighbor upscale
- Thread pool for parallel triangle rasterization
Shading
- Flat shading
- Gouraud shading with per-vertex lighting
- Specular highlights (Blinn-Phong)
- Procedural shaders (stone, wood, plane/checkerboard)
- Dynamic point lights
Post-Processing
- SSAO (screen-space ambient occlusion) — multi-radius sampling, single-pass fused compute+apply
- Depth fog (distance-based atmospheric fog)
- Light fog (volumetric light scattering)
- Edge-detect anti-aliasing (FXAA-style)
Engine
- OBJ model loading with TGA textures
- Scene file format for placing models
- First-person camera with configurable FOV and clip distances
- In-engine settings menu (render, camera, fog controls)
- HUD overlay with FPS and position readout
- SIMD and scalar code paths (build with
-DSIMD=ONor-DSIMD=OFF)
Building
Requires SDL2 and CMake.
mkdir build && cd build
# SIMD enabled (recommended)
cmake -DSIMD=ON .. && make -j$(nproc)
# Scalar fallback
cmake -DSIMD=OFF .. && make -j$(nproc)
On macOS, use sysctl -n hw.ncpu instead of nproc.
References
- 3D Math Primer for Graphics and Game Development, 2nd Edition
- Mathematics for 3D Game Programming and Computer Graphics, 3rd Edition
- Eric Zhang — Graphics Blog
- ssloy — tinyrenderer
- Fabian Giesen — Software Occlusion Culling
- Karl Techno — Software Rasterizer
TODO
Rendering
- Shadow mapping
- Normal mapping
- Texture filtering (bilinear / mipmaps)
- Occlusion culling
- LOD (level of detail) mesh switching
Physics Engine
- Rigid body dynamics (position, velocity, acceleration integration)
- Collision detection — broad phase (spatial hashing or BVH)
- Collision detection — narrow phase (GJK / SAT)
- Collision response (impulse-based resolution, restitution, friction)
- AABB and OBB bounding volumes
- Gravity and constant force fields
- Constraint solver (contact constraints, joint constraints)
- Spatial partitioning for scalable object counts
- Raycasting (for picking, line-of-sight, projectiles)
- Static vs. dynamic body types (infinite mass statics)
- Sleep / deactivation for resting bodies
Engine
- Scene graph / transform hierarchy
- Entity-component system
- Audio
- Scripting / hot-reload