Skip to content

Path Tracer With BVH

You'll turn your ray tracer into a renderer that handles a thousand-triangle mesh in minutes instead of days, with a tree of bounding boxes and sampling that treats light the way physics does.

About

A ray tracer that tests every triangle for every ray takes a day to render a bunny. A bounding volume hierarchy, which is a tree of boxes around boxes, cuts that to minutes, and building one properly is the first real data structure in this track. On top of that, a path tracer treats light the way the physics does: emitters, cosine-weighted bounces, Russian roulette to end paths fairly, and sampling the light directly so the noise clears in a reasonable time. This is weeks of evenings. Budget a week for the BVH alone, since a tree that works but is slow is the normal first result, and the fix is splitting by the surface area heuristic rather than down the middle.

At a glance

Per requirement
35 XP
Completion bonus
300 XP
Requirements
6
Takes
Three to six weeks
Skill level
Advanced (years of practice)
Cost
Free
Supplies
Nothing special
Where
At home
Other people
On your own
Locked for now
Earn two more Uncommon badges in Graphics Programming to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Load a mesh of at least a thousand triangles and render it with no acceleration, timed. The Stanford bunny is free and has 70,000 triangles, so use the decimated version with a few thousand or any other model in that range. Render it at a low resolution and write down the time, which will be awful. Take a screenshot with the triangle count and the time in the post. Photo
  2. 2
    Build a BVH and show the same render at least fifty times faster. Split primitives by the surface area heuristic, cap leaves at a few triangles, and traverse the nearer child first. Render the same scene and compare the times. Take a screenshot of the render with both times, and add a short note on how deep the tree went. Photo
  3. 3
    Add an emissive material and render a Cornell box lit only by its ceiling light. The Cornell box is the standard scene, with free coordinates online, and the color bleeding from the red and green walls onto the white boxes is the sign your bounces are right. Take a screenshot of it at 100 samples or more. Photo
  4. 4
    Sample the light directly and show the noise drop at equal samples. This is next event estimation: at every bounce, also shoot a ray straight to a point on the light. Render the Cornell box at 16 samples with and without it. Take a screenshot of both side by side. Photo
  5. 5
    Split the image into tiles and render them on every core. Hand each thread a tile from a shared queue rather than a fixed stripe, so the easy tiles don't leave cores idle at the end. Print the speedup against a single thread. Take a screenshot of the output with the core count and the speedup. Photo
  6. 6
    Render a scene of your own design overnight and post it. Build or find a free model, light it with an emitter, and let it run to at least 1,000 samples per pixel. Post the final image with the sample count, the triangle count and the render time. Photo