Building My Own Car Racing Simulator with DirectX 12
A Deep Dive into Custom Engines, Physics, and Tools
In the last time, I’ve been developing my own car racing simulator from scratch — using DirectX 12, a fully custom engine, and a suite of in-house terrain, physics, and rendering tools.
It’s been both an enormous challenge and one of the most rewarding experiences of my career as a game developer.
Why Build Everything Myself?
I could have started from Unreal or Unity, but I wanted complete control over every aspect of the pipeline — from low-level rendering and GPU synchronization to the way the physics interacts with the track surface.
DirectX 12’s explicit control over resources and command queues made it perfect for this type of project, even if it meant writing thousands of lines of boilerplate to get the first triangle on screen.
The goal wasn’t just to make a racing game, but to build the foundation of a simulation framework I can extend into other genres later — flight, off-road, open-world driving.
The Rendering Pipeline
The engine uses a fully deferred renderer built on DirectX 12, supporting:
HDR output with Rec.2020 + PQ (ST.2084) color encoding
ACES tone mapping
Physically based materials (PBR) with image-based lighting
Real-time reflections using screen-space tracing blended with planar probes
One of the biggest technical hurdles was managing GPU memory efficiently. DirectX 12’s manual resource state transitions forced me to write a custom resource tracker that validates barriers at runtime and optimizes state changes per frame.
For terrain and world data, I rely on my own Gaea-inspired terrain system, exporting 32-bit heightmaps and procedural masks that define materials like asphalt, gravel, and grass.
Physics and Vehicle Dynamics
The simulator uses a custom vehicle physics model, written in C++.
Each wheel simulates:
Suspension compression
Tire slip and grip
Brake and throttle torque
Dynamic friction against the terrain surface
The result feels raw and mechanical — the car doesn’t just slide; it communicates through weight transfer, grip loss, and body roll.
I also implemented aerodynamic drag and downforce.
Custom Tools and Workflow
To speed up development, I built several companion tools:
Terrain Editor: imports 32-bit heightmaps and blends masks directly from Gaea.
Material Graph Editor: node-based PBR material creation with live viewport updates.
Track Layout Tool: spline-based editor for track curves, banking, and elevation.
Each tool shares a unified data format with the game engine, allowing near-instant iteration between editing and testing — no import/export bottlenecks.
DirectX 12 Challenges
Working at such a low level is rewarding but brutal. Some of the biggest issues I faced:
Debugging GPU synchronization and fence deadlocks.
Managing descriptor heaps efficiently for thousands of draw calls.
Writing my shaders.
Handling HDR color calibration across displays.
Despite the complexity, DirectX 12 gave me predictability and raw power — the game now runs in 4K HDR, with volumetric lighting and motion blur enabled.
October 19, 2025