Code for "How to Build a BVH"
INSTRUCTIONS: Open the "_ bvhdemo.sln" file (all the way at the top!), and make one of the 10 projects the active project.
Note: project files are for Visual Studio 2019; they will convert without issues to 2022 though.
Each project implements one of the 10 articles:
part 1, basics:
https://jacco.ompf2.com/2022/04/13/how-to-build-a-bvh-part-1-basics
...Which explains how to set up a minimal but working BVH in about 300 lines of code.
Project: basics.vcxproj, files: basics.cpp, basics.h
part 2, faster rays:
https://jacco.ompf2.com/2022/04/18/how-to-build-a-bvh-part-2-faster-rays
...in which rays are traced faster, at the expense of BVH build time.
Project: faster.vcxproj, files: faster.cpp, faster.h
part 3, quick builds:
https://jacco.ompf2.com/2022/04/21/how-to-build-a-bvh-part-3-quick-builds
...explains how a high-quality BVH can be constructed rapidly.
Project: quickbuild.vcxproj, files: quickbuild.cpp, quickbuild.h
part 4, animation:
https://jacco.ompf2.com/2022/04/26/how-to-build-a-bvh-part-4-animation
...in which various forms of animation are applied to BVHs.
Project: animation.vcxproj, files: animation.cpp, animation.h
part 5, TLAS & BLAS:
https://jacco.ompf2.com/2022/05/07/how-to-build-a-bvh-part-5-tlas-blas
...describes how a lot of BVHs can be made into one.
Project: toplevel.vcxproj, files: toplevel.cpp, toplevel.h
part 6, TLAS & BLAS part 2:
https://jacco.ompf2.com/2022/05/13/how-to-build-a-bvh-part-6-all-together-now
...which completes the discussion of article 5.
Project: alltogether.vcxproj, files: alltogether.cpp, alltogether.h
part 7, consolidation:
https://jacco.ompf2.com/2022/05/20/how-to-build-a-bvh-part-7-consolidate
...in which the BVH is applied to some nicer renders.
Project: pretty.vcxproj, files: pretty.cpp, pretty.h, bvh.cpp, bvh.h
part 8, whitted:
https://jacco.ompf2.com/2022/05/27/how-to-build-a-bvh-part-8-whitted-style
...completing part 7, with full recursive ray tracing, in real-time.
Project: whitted.vcxproj, files: whitted.cpp, whitted.h, bvh.*
part 9a, GPGPU:
https://jacco.ompf2.com/2022/06/03/how-to-build-a-bvh-part-9a-to-the-gpu
...which is really a GPGPU tutorial, using BVHs as an example.
Project: gpgpu.vcxproj, files: gpgpu.cpp, gpgpu.h, bvh.*
part 9b, 'massive':
https://jacco.ompf2.com/2022/06/15/how-to-build-a-bvh-part-9b-massive
...series finale, with TLAS & BLAS on the GPU. Also: GL/CL interop.
Project: massive.vcxproj, files: massive.cpp, massive.h, raytracer.cl.
NOTE: All projects share the same template files and build directories.
DISCLAIMER: None of this is supposed to be 'production quality'.
LICENSE: This code is covered by the Unlicense. Feel free, no strings.
P.S.: Follow me on Twitter, @j_bikker.