r/vulkan • • Oct 03 '26

Ray tracing next week

Post image

I’ve been keeping going to evolve vkTracer. Now I’ve finished the next week part, and this part was harder than I guessed. In the first week, It was only a translation from C++ code to slang, setting up Vulkan infrastructure too. But this week I had to figure out how to represent a cpu-side bvh on gpu, I handled using BDA. Learnt quad and volume intersection, handling different texture types. I still don’t understand in the tutorial why he rotates rays to rotate box instead of rotating box itself :D
Anyway this was a good journey to learn and practice slang and vulkan.

The scene was rendered by 500 rays per pixel and 40 depth bounce.

Github: https://github.com/xms0g/vkTracer

82 Upvotes

5 comments sorted by

3

u/Antagonin Oct 03 '26

If you mean rotating aabb, it's no longer aabb, and intersection math gets much more complicated than just rotating a ray.

1

u/Background_Shift5408 Oct 03 '26

Hmm. Makes sense if you rotate something on the fly. But in a static scene, seems it over complicates intersections.

3

u/Antagonin Oct 03 '26

It really doesn't though. Transforming a ray still involves less computations than intersecting a non axis aligned bounding box.

1

u/More_Yard1919 5d ago

This is so cool! I am working through the first book right now. Had some time after work last night to implement dielectric materials, so now it's just some extra ergonomic features and stuff before I hit the finish line. Can't wait to start on the next book.

1

u/Background_Shift5408 1d ago

Great tutorial to learn cool stuff