GPSnoopy / RayTracingInVulkan

Implementation of Peter Shirley's Ray Tracing In One Weekend book using Vulkan and NVIDIA's RTX extension.
BSD 3-Clause "New" or "Revised" License
1.26k stars 116 forks source link

Visualising Acceleration Structure #27

Closed PMunkes closed 3 years ago

PMunkes commented 3 years ago

Hi, I don't know if this would be difficult, but would it be possible to visualize the aabb boundaries? I saw this very interesting visualization and wondered if it would be difficult to implement something similar:

https://twitter.com/PierreTerdiman/status/1355851691762061312?s=20

GPSnoopy commented 3 years ago

By nature of the Vulkan VK_KHR_acceleration_structure extension, the actual implementation of the acceleration structure is left undefined. So it doesn't expose back the AABB boundaries and hierarchy in such a way that they can be visualised within the app (at least none that I know of).

Nsight Graphics allows you to visual the structures and geometry when debugging Vulkan application. I used it several times when creating this app and porting it to the newer extension. Particularly useful to debug off-by-one and other offset errors. But then again, it shows you the hierarchy and geometry that the application submitted, not the lower-level BVH of how the GPU broke down the AABB sections.

https://developer.nvidia.com/nsight-graphics

So not sure if this is feasible. It would be interesting to know how NVIDIA Vulkan driver developer visualise the internal structure themselves, they must have some tools to do so.

PMunkes commented 3 years ago

Thanks for the heads up and the explanation. Those internal tools would be very interesting, but more as a curiosity.

It seems as if it would be feasible to reverse engineer something for AMD, since they seem to implement a BVH4 structure, I found a thread where some guys are reverse engineering RDNA2 RT, in case you want more information: https://forum.beyond3d.com/threads/rdna-2-ray-tracing.62161/

I'll close this issue. Thanks again