Code accompanying the blog post on bvh construction.
  • C 79.4%
  • C++ 19.4%
  • Objective-C 1.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-10-05 09:03:59 +02:00
assets New files for article 9b. 2022-06-06 15:35:07 +02:00
cl Updated to new template. 2024-06-22 20:14:23 +02:00
lib Updated to new template. 2024-06-21 20:24:45 +02:00
template Updated to new template. 2024-06-21 20:24:45 +02:00
.gitignore Initial commit 2022-04-13 17:25:55 +02:00
_ bvhdemo.sln Several small fixes based on reader suggestions. 2022-06-17 12:48:03 +02:00
_ getting started.pdf Initial release. 2022-04-13 17:30:34 +02:00
alltogether.cpp Added teapot 2022-06-02 10:52:48 +02:00
alltogether.h Files for article 7, under construction. 2022-05-18 20:19:37 +02:00
alltogether.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
alltogether.vcxproj.filters Adding initial files for article 6. 2022-05-09 12:46:00 +02:00
animation.cpp Added teapot 2022-06-02 10:52:48 +02:00
animation.h Added initial code for article 5. 2022-05-02 20:01:22 +02:00
animation.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
animation.vcxproj.filters Preparing for animation article. 2022-04-22 15:20:44 +02:00
basics.cpp Fixed confusing screenpos calculation in chapter 2. 2023-08-28 11:19:26 +02:00
basics.h Preparing for second article. 2022-04-18 20:54:53 +02:00
basics.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
basics.vcxproj.filters Preparing for second article. 2022-04-18 20:54:53 +02:00
beyond.cpp Fixed pretty app: didn't work with new parallel bvh build code. 2022-08-12 13:15:30 +02:00
beyond.h Fixed pretty app: didn't work with new parallel bvh build code. 2022-08-12 13:15:30 +02:00
beyond.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
beyond.vcxproj.filters Now 16 threads for ~11ms, cleaned up code. 2022-07-13 12:10:47 +02:00
bvh.cpp _mm_shuffle for area calculation (#8) 2024-10-05 09:03:59 +02:00
bvh.h Updated to new template. 2024-06-22 20:14:23 +02:00
clean.bat Initial release. 2022-04-13 17:30:34 +02:00
faster.cpp Fixed confusing screenpos calculation in chapter 2. 2023-08-28 11:19:26 +02:00
faster.h Preparing for second article. 2022-04-18 20:54:53 +02:00
faster.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
faster.vcxproj.filters Preparing for second article. 2022-04-18 20:54:53 +02:00
gpgpu.cpp Updated to new template. 2024-06-22 20:14:23 +02:00
gpgpu.h Final fixes. 2022-06-15 11:32:30 +02:00
gpgpu.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
gpgpu.vcxproj.filters Improved OpenCL template code for article 9. 2022-05-28 16:59:03 +02:00
kdtree.h Cleaned up some more. 2022-07-13 13:26:35 +02:00
LICENSE Initial commit 2022-04-13 17:25:55 +02:00
massive.cpp Final fixes. 2022-06-15 11:32:30 +02:00
massive.h Final fixes. 2022-06-15 11:32:30 +02:00
massive.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
massive.vcxproj.filters Code update for article 9b. 2022-06-11 16:17:32 +02:00
pretty.cpp Fixed crash in some projects. 2022-12-13 16:21:39 +01:00
pretty.h Final fixes. 2022-06-15 11:32:30 +02:00
pretty.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
pretty.vcxproj.filters Files for article 7, under construction. 2022-05-18 20:19:37 +02:00
quickbuild.cpp Added teapot 2022-06-02 10:52:48 +02:00
quickbuild.h Added quickbuild project for third article. 2022-04-21 18:52:20 +02:00
quickbuild.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
quickbuild.vcxproj.filters Added quickbuild project for third article. 2022-04-21 18:52:20 +02:00
README.md Update README.md 2022-07-15 14:08:25 +02:00
toplevel.cpp Added teapot 2022-06-02 10:52:48 +02:00
toplevel.h Files for article 5. 2022-05-07 20:01:26 +02:00
toplevel.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
toplevel.vcxproj.filters Added initial code for article 5. 2022-05-02 20:01:22 +02:00
whitted.cpp Fixed crash in some projects. 2022-12-13 16:21:39 +01:00
whitted.h Final fixes. 2022-06-15 11:32:30 +02:00
whitted.vcxproj Updated to new template. 2024-06-21 20:24:45 +02:00
whitted.vcxproj.filters Initial commit for article #8. 2022-05-23 14:26:27 +02:00

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.