Overview
Clean path-traced images need thousands of samples per pixel, which is slow on a CPU. I wanted to know how close a fast, noisy render plus a denoiser and an AI pass can get to a high-sample reference, how that compares with a GPU path tracer and a game-style rasterizer on the same shot, and what the AI changes along the way. I wrote the CPU path tracer first, in April 2026. In November 2026 I turned it into a small rendering lab: set up a shot in a real-time DirectX 12 viewport, record a camera path, and render that exact shot four ways, frame for frame. All four renderers read the same scene file and camera, so their frames line up pixel for pixel and can be scored against a 16,384-sample reference with PSNR, SSIM and FLIP. The night docks shot at the top is the same pipeline at production scale: 2.74 million triangles lit by moonlight, fire and fog.
What I built
- CPU path tracer Unidirectional path tracing with next-event estimation and multiple importance sampling (power heuristic), Russian roulette from depth 3 and firefly clamps, plus direct-lighting, instant-radiosity, photon-mapping and light-tracing modes. Lambert, Oren-Nayar, mirror, rough conductor (GGX, complex IOR), glass, rough glass, plastic and layered materials; area lights sampled by power, and environment maps.
- Fast on the CPU A binned-SAH BVH and 64×64 tiles across all 32 threads of a Ryzen 9 9950X, with progressive accumulation: about 76 million rays per second.
- DirectX 12 platform My own D3D12 layer, replacing the D3D11 framework the project started on: a flip-model swapchain with 3 frames in flight, descriptor heaps, upload and readback, GPU timestamp queries, ImGui and DXC shader builds. One upload of the scene feeds both GPU renderers.
- DXR path tracer An HLSL port of the CPU integrator and every material, using DXR 1.1 inline ray queries in a compute shader. The same pixel filter and deterministic per-frame seeds let its frames be checked against the CPU's.
- Raster viewport A real-time preview on the CPU camera's exact pixel grid in under 1 ms: a 2048² shadow map with 5×5 PCF, emitters grouped into point lights, blended glass and the same tonemap as the path tracers.
- Camera paths and sequence export Keyframe or live-record a fly-through (Catmull-Rom on a fixed frame grid, scrubbed in a timeline panel), then render it with any backend. Every frame writes beauty, HDR, denoised, albedo, normal, depth and camera data with timings; runs resume and every frame is reproducible.
- AI pass Stable Diffusion XL img2img at strength 0.4, starting from the denoised frame with a fixed seed and prompt, with ControlNet Union fed the renderer's own depth and normals so the geometry stays locked. The previous AI frame is warped into the current view with the renderer's exact depth and camera, then blended where the surface was visible in both: temporal stability without optical flow.
- Production shot The night docks: 2.74 million triangles exported from Unreal Engine 5.8 as glTF, a skinned walk baked per frame, a procedural moonlit sky, blackbody fire, and smoke and mist volumes path traced with delta and ratio tracking. Motion blur comes from 4 sub-frames across a 180° shutter, denoised with Intel OIDN using albedo and normal guides.
- Measurement tools Python tools that score every frame against the reference (PSNR, SSIM, FLIP), measure flicker with the camera motion removed, and assemble the comparison videos.
Results
| Renderer | Cost per frame | PSNR dB | SSIM | FLIP | Flicker |
|---|---|---|---|---|---|
| GPU raster (D3D12) | 0.4 ms GPU | 22.4 | 0.925 | 0.248 | 0.0016 |
| DXR path tracer, 1,024 spp | 1.6 s GPU | 42.6 | 0.957 | 0.020 | 0.0080 |
| CPU path tracer, 64 spp | 6.8 s | 30.8 | 0.627 | 0.054 | 0.0269 |
| CPU 64 spp + OIDN | +0.15 s | 44.4 | 0.992 | 0.025 | 0.0036 |
| CPU 64 spp + OIDN + AI | +13.6 s GPU | 30.9 | 0.960 | 0.118 | 0.0043 |
| Same AI pass, no reprojection | 30.3 | 0.954 | 0.120 | 0.0078 |
Hard parts
- Feeding the previous AI frame back in as the diffusion input made invented detail compound from frame to frame: lamps appeared on the walls and the sphere grew a pattern. Diffusion now always starts from the clean render, and the smoothing happens afterwards by reprojection, which took flicker from 0.0078 to 0.0043.
- Proving the GPU port is right, not just fast: at 1,024 spp on the same frame, the DXR image's mean brightness is within 0.16% of the CPU's, and quality per sample matches along the whole ladder (30.8 vs 30.5 dB at 64 spp, 42.2 vs 42.5 dB at 1,024).
- Measuring a moving shot fairly: flicker is the mean change between frames after the camera motion is removed with the renderer's own depth and cameras, so it measures the renderer, not the camera move.
Limits
- The AI pass invents and changes detail; it isn't a faithful denoiser. The glass sphere loses its refraction detail, and at strength 0.55 it turned the glass to stone and a reflection into an apple. Its lower scores measure how far it re-imagines the frame.
- Only the raster preview runs in real time. The CPU frames (about 7 s each), the AI pass (about 14 s) and the high-sample DXR frames (1.6 s at 1,024 spp, 15.2 s for a docks frame) are offline renders.
- The raster lighting is approximate on purpose: emitters as point lights, one shadow map, no mirror reflections and an ambient fill tuned against the reference.
- The DXR port maps the layered material to its base layer. Windows and DirectX 12 only; the DXR path needs a DXR 1.1 GPU.
Credits. 3D assets: a docks environment and the Dark Knight character from Fab. Denoiser: Intel Open Image Denoise. AI pass: Stable Diffusion XL base 1.0 and ControlNet Union SDXL, run locally in ComfyUI.











