Daily Pathtracer Part 0: Intro
As mentioned before, I realized I’ve never done a path tracer. Given that I suggest everyone else who asks “how should I graphics” start with one, this sounded wrong. So I started making a super-simple one. When I say super simple, I mean it! It’s not useful for anything, think of it as [smallpt] with more lines of code :)
However I do want to make one in C++, in C#, in something else perhaps, and also run into various LOLs along the way. All code is at github.com/aras-p/ToyPathTracer.
Now, all that said. Sometimes it can be useful (or at least fun) to see someone who’s clueless in the area going through parts of it, bumping into things, and going into dead ends or wrong approaches. This is what I shall do in this blog series! Let’s see where this path will lead us.
- Part 1: Initial C++ implementation and walkthrough.
- Part 2: Fix stupid performance issue.
- Part 3: C#, Unity, Burst.
- Part 4: Fixing wrong rendering, and Mitsuba.
- Part 5: GPU implementation for Metal.
- Part 6: GPU implementation for D3D11/HLSL.
- Part 7: Initial C++ SIMD & SoA attempt.
- Part 8: SIMD SSE HitSpheres, and a larger scene.
- Part 9: A wild ryg appears and optimizes my code!
- Part 10: Let’s unify all implementations so that they render the same scene again etc.
- Part 11: Attempt at a buffer-oriented approach.
- Part 12: Buffer-oriented approach on the GPU.
- Part 13: GPU performance boost via thread group data caching.
- Part 14: Let’s make it run on iOS.
- Part 15: Pausing it all, and a bunch of links.
- Part 16: Update Unity Burst code with 4-wide HitSpheres.
- Part 17: WebAssembly version.
Actually useful resources
If you want to actually learn someting about path tracing or raytracing, I’d suggest these:
- “Physically Based Rendering: From Theory to Implementation” (free online version) by Pharr, Jakob, Humphreys. It’s excellent, and explains pretty much everything.
- For a much lighter introduction, “Ray Tracing in One Weekend” and two follow-up minibooks by Shirley are really good (and dirt cheap!).
- “The Graphics Codex” app by McGuire is great.
- Presentation slides on smallpt are a good intro too.