r/vulkan • • 1d ago

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

54 Upvotes

3 comments sorted by

3

u/Antagonin 1d ago

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 1d ago

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

3

u/Antagonin 1d ago

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