Skip to content

Interactive Path Tracer

You'll move your offline renderer onto the GPU so it draws progressively while you fly the camera, with the BVH in a buffer and an image that cleans up when you hold still.

About

An offline path tracer takes minutes per frame. The same math on a GPU takes milliseconds per sample, and if you accumulate samples across frames you get a picture that's noisy while you move and clean when you stop, which is how the big renderers' viewports work. It means flattening your BVH into a buffer the GPU can walk, writing the traversal in a shader without recursion, and handling random numbers across thousands of threads. Hardware ray tracing (RTX, Vulkan or DirectX ray tracing) is allowed but not required, since a compute shader with a good BVH gets there too. This is a season, and the first time you orbit a Cornell box in real time it will feel like cheating.

At a glance

Per requirement
50 XP
Completion bonus
600 XP
Requirements
7
Takes
A season
Skill level
Advanced (years of practice)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
With other people
Locked for now
Earn two more Rare badges in Graphics Programming to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Trace primary rays against spheres in a fragment or compute shader. Draw just the first hit, colored by normal, with the camera passed as a uniform. Film the camera orbiting at a real frame rate. Video
  2. 2
    Flatten your BVH into a buffer and traverse it on the GPU with a stack, not recursion. Use a fixed-size stack array in the shader, with the nodes in a storage buffer or a texture. Render a mesh of at least 10,000 triangles. Take a screenshot with the triangle count and the frame time on screen. Photo
  3. 3
    Accumulate samples across frames and reset when the camera moves. Keep a running average in a texture and blend each new sample in. Film the image going from noise to clean over a few seconds after you stop moving, with the sample count on screen. Video
  4. 4
    Generate good random numbers per pixel per frame. Use a hash of the pixel position and the frame number, or a blue noise texture. Bad randomness shows up as patterns in the noise. Take a screenshot of the image at one sample per pixel showing noise with no visible pattern. Photo
  5. 5
    Match your offline renderer on the Cornell box. Render the same box at the same sample count on both and put them side by side. They should be hard to tell apart. Take a screenshot of both, with any difference you found explained. Photo
  6. 6
    Add a denoiser or reprojection so moving looks acceptable. A simple spatial blur guided by normals and depth is enough. Film thirty seconds of flying through a scene with it on. Video
  7. 7
    Show it to someone who works in graphics or games and write down their first question. A meetup, a screen share on a Discord, or a coworker all count. Take a screenshot or a photo of the demo running for them, and write the question and your answer. Photo