C++17 · SDL2 · OpenGL 3.3

Software Renderer

A CPU-side 3D renderer built from scratch — custom framebuffer, z-buffer, triangle rasterizer, perspective projection, and a neon city scene with GPU bloom post-processing.

C++17 SDL2 OpenGL 3.3 Windows ~60 FPS

Live Demos

See It In Action

Rotating 3D shapes rendered entirely on the CPU
SoftwareRenderer — CPU Core
Rotating 3D shapes (cube, tree, carrot, ent) rasterized pixel-by-pixel on the CPU. Perspective projection, z-buffering, and triangle fill — no GPU draw calls.
NeonCity — GPU Post-Process
Procedural wireframe cityscape rendered on the CPU, then composited with multi-pass GPU bloom (bright-pass → Gaussian blur → HDR composite) via OpenGL 3.3.

What's Inside

Features

■
Custom Framebuffer
Hand-rolled color + depth buffer. Each pixel stores a packed BGRA uint32 and a float z-value. Fully CPU-side — no GPU state needed for the core renderer.
△
Triangle Rasterizer
Barycentric-coordinate rasterization with z-interpolation and depth testing. Flat shading with per-triangle brightness multiplier.
◆
Perspective Projection
Full 3D-to-2D perspective divide with configurable FOV. Supports multiple 3D shapes: cube, tree, carrot, ent, and more.
★
Thick Line + Glow
Screen-space thick lines with additive glow layers. Core lines are depth-tested; glow halos are additive-blended for a neon aesthetic.
✤
GPU Bloom (NeonCity)
OpenGL 3.3 post-process pipeline: upload CPU framebuffer as texture, bright-pass filter, separable Gaussian blur, HDR tone-mapped composite.
◒
Frame Export
Record N frames to PPM with --record. Convert to GIF or MP4 via the bundled shell scripts using ffmpeg.
☍
Procedural City
28×28 grid of procedurally generated buildings with randomised heights, widths, antenna spires, and neon colour palettes.
⚙
Multiple Backends
SDL2 windowing (primary), Win32 GDI backend, and an SDL3 experiment. The same Renderer class drives all backends.

Architecture

Two Rendering Modes

⸻ SoftwareRenderer.exe

  • SDL2 window + event loop
  • Custom Renderer class (CPU-only)
  • FrameBuffers — color & depth buffers
  • Perspective projection matrix
  • Triangle fill with z-test
  • Line rasterizer (Bresenham)
  • Shape switcher: cube / tree / carrot / ent
  • PPM frame export for GIF/MP4

⸻ NeonCity.exe

  • Same CPU Renderer for wireframe city
  • Procedural 28×28 building grid
  • Smooth camera orbit with exponential smoothing
  • CPU buffer uploaded as GL texture each frame
  • Bright-pass → Gaussian blur (ping-pong FBOs)
  • HDR tone-mapped composite shader
  • OpenGL 3.3 core profile + GLEW
  • SDL2_image sprite blending (cat easter egg)

Get Started

Build & Run

MSYS2 / MinGW64
# 1. Install dependencies (MSYS2 MinGW64 shell)
pacman -Syu
pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2 \
         mingw-w64-x86_64-glew make ffmpeg

# 2. Clone and build the core renderer
git clone https://github.com/plasmacat420/SoftwareRenderer.git
cd SoftwareRenderer
make
./SoftwareRenderer.exe

# 3. Build and run the Neon City scene
make NeonCity
./NeonCity.exe

# 4. Export a GIF (180 frames @ 30 FPS ≈ 6 sec)
./SoftwareRenderer.exe --width 800 --height 600 --record 180 --record-fps 30
./scripts/make_gif.sh frames 30 out.gif out.mp4

Prebuilt Windows binaries are available under Releases — no build environment needed.