Skip to content

CPU/GPU Dual Rasterizer

A toggleable software (CPU) and hardware (DX11) rasterizer built to explore the math and mechanics of real-time rasterization.

Goals

The Dual Rasterizer project was created with three main goals in mind.

The first goal was to understand the math and logic behind real-time 3D rendering. Starting with a software rasterizer on the CPU forced me to do everything manually, from vertex transformations, perspective projection, and triangle rasterization to depth testing, shading, and more. Doing it all manually really helped me understand what each step in the graphics pipeline does, instead of letting the GPU "just handle it".

Once I had the basics down on the CPU side, the second goal was to take those same ideas and apply them to a GPU renderer using DirectX 11. That part was about learning how the graphics pipeline works in a real-world setting, working with shaders, buffers, sampler states, and all that. Having done it all in a software version first made it way easier to understand what the GPU pipeline is actually doing, instead of just copying examples.

The third goal was to combine the two. Allowing you to switch between the software and hardware rasterizer at runtime while still maintaining clean code.

Features

Dual Backend

Switch between a custom CPU rasterizer and a DX11-based GPU implementation for comparison and learning.

Normal Mapping

Both renderers support tangent-space normal mapping for added surface detail.

Transparency

Basic transparency is supported in both renderers using alpha blending.

Cull Mode Toggle

Easily switch between backface, frontface, or no culling to inspect geometry rendering.

Depth & Normal Visualizations (CPU)

Debugging tools to visualize depth buffer, normals, and wireframe views.

Bounding Box Display (CPU)

Enables visual debugging by drawing AABBs around mesh geometry.

Shadow Mapping (GPU)

The GPU rasterizer supports directional shadow mapping.

Sampler State Toggle (GPU)

Switch between point, linear, and anisotropic sampling at runtime.

Select an item

Hover or tap a feature to see its description.

Display

Final Render
No Shadow
Vehicle
Bounding Box
Wireframe