How do you render an object? How do you make it move? What is a shader? How do you even get a window to appear on the screen?
Read along as I explore these questions and more while building a game engine from scratch, using Zig, SDL3 and Slang.
Why I’m doing this
I’m starting this series to force my brain into teacher-mode while I build up my 3D graphics skills. So far I’ve been using my intuition (trial and error, let’s be honest) to stumble through setting up graphics pipelines, multiplying matrices, and writing shaders. Yet once it’s running smoothly, I realize I only have a surface-level understanding of what I’ve built.
The entire reason I’ve been learning this stuff is to understand what’s happening inside the box, instead of simply ending up with something colorful on the screen.
So, I’ve started asking myself “why?”, digging into first principles and writing it all out until these ideas are clear and well-structured in my head. As a bonus, I should end up with an archive of self-contained lessons and explorations focused on the various challenges I’ve overcome and the topics I’ve found myself drawn to. Before I begin answering these questions, let’s go back about fifteen years.
How it started
During my last few years of school, instead of doing my homework or studying for exams like a good kid, I spent all my spare time teaching myself Blender. This powerful free tool stole my attention, letting me create anything I could imagine: monsters, guitars and even capsicums (I was super creative).
I moved to Sydney and attended a VFX Film and Media college where I learnt how to use Maya, and was taught the fundamentals behind techniques I had been noodling around with. A senior student introduced me to Python, demonstrating how it could speed up artists’ workflows with custom-built UI tooling. I was hooked. I just had to immerse myself in this new world I had found, and so I enrolled in a Software Development course.
After completing the course, I landed my first job as a programmer. Here I spent a lot of time migrating sections of our legacy web application to React, a popular frontend library. Working with React was an absolute joy. Seeing my changes appear instantly on the screen felt refreshing compared to the slow-compiling backend code that I’d become complacent with. These quick feedback loops gave me the same feeling that had drawn me to Blender years earlier.
Sounds wild, but I’ve been a web developer for nearly ten years now, and in all that time, understanding what the computer was doing has never been part of the job. The browser draws the pixels, the framework decides when to update them, and it works well enough that you stop asking.
Recently I’ve been working through Casey Muratori’s course Computer Enhance, and my good friend Nic Barker’s course The Simple Joy of Programming. These courses have inspired me to push my curiosity further and learn how computers work. Here I am, back where I started, except now I’m building the thing I used to build with. After nearly a decade, I’m going to find out what was happening between my keyboard and the screen.
Before we begin
I’ll be working on a Mac, so SDL3 will be using Metal to talk to the GPU. On other platforms it’ll use D3D12 or Vulkan instead. The code and concepts are the same, I’ll make it clear when something is platform-specific.
I’m figuring this out as I go, so be prepared for me to go back and fix older articles as my assumptions change. I’ll leave the interesting mistakes in, and we can solve them together. Eventually, we’ll end up with an intuitive foundation in 3D graphics, and our own functioning game engine to build upon.
You don’t need to know Zig, SDL3, or computer graphics to follow along; however, you’ll definitely want some programming experience and to know how to use a terminal.
Next up, let’s get our first window to appear on screen!