Hack-a-Raster

C++SDL3Linear Algebra

View on GitHub

Overview

Hack-a-Raster is a software rasterizer built in 12 hours for a hackathon that renders 3D graphics entirely on the CPU. I implemented a simple graphics pipeline without relying on a graphics API.

Demos

Pyramids Spin Cow

Technical Implementation

  • Vector and Matrix Math: Custom linear algebra library for 3D transformations
  • Indexed Rendering: Geometry representation with vertex and index buffers
  • Barycentric Interpolation: Interpolation of vertex attributes across triangle surfaces
  • Depth Testing: z-buffer implementation for occlusion
  • Perspective Projection: Project 3D world coordinates to screen space

Architecture

The project intentionally avoids graphics APIs to help me focus on understanding some of the core rendering algorithms that are not often considered when using graphics APIs.

SDL3 was used only for window handling and drawing pixels to the screen.

What I Learned

  • Math for 3D graphics
  • How the graphics pipeline logically works under the hood