GPUOpen-Tools / radeon_raytracing_analyzer

The Radeon Raytracing Analyzer (RRA) is a tool to visualize and inspect Bounding Volume Hierarchies (BVH) for ray tracing applications.
MIT License
245 stars 21 forks source link

"Color geometry by tree level (Triangle)" works incorrectly #7

Closed w-pearson closed 4 months ago

w-pearson commented 10 months ago

In V1.0, the "Color geometry by tree level (Triangle)" coloring mode gives a useful gradient that works with normal tree levels. In later versions, however, nearly everything is the same color, with only tiny bits of geometry being different colors.

Specifically, I'm pretty sure this was introduced in V1.1, as that replaced changed RraVertex's geometry_index_depth_opaque to geometry_index_depth_split_opaque, meaning depth is bits 15-2 instead of 15-1, but it never updated shaders/GeometryColorTreeLevel.vs.spv to account for this change. The original shader source code doesn't seem to be in the repo, but spirv-cross decompiles that as having out_var_METADATA0 = (in_var_METADATA0 >> 1u) & 32767u; when I'm pretty sure it should have been changed to out_var_METADATA0 = (in_var_METADATA0 >> 2u) & 16383u;; it's effectively multiplying the depth by 2 and adding the split flag.

This can be reproduced by loading the sample trace in V1.0, then switching to either the TLAS or BLAS tab, and then selecting "Color geometry by tree level". Disabling wireframes also helps make it more obvious. Then, load the sample capture in a current version and repeat these steps, and should be fairly obvious that something is wrong.

"Color geometry by max tree depth (BLAS)" appears to work correctly, and can be used as a comparison as well (the bug means that individual triangles appear to be at a higher depth than the maximum tree depth).

Screenshots: RRA_Tree_Level.zip (I was unable to get V1.1 or V1.1.1 to work on my machine, so the screenshots are from V1.0 and V1.2. V1.3.1 is also affected.)

can-alper-amd commented 10 months ago

Hi, I've filed an internal ticket to get this fixed in an upcoming release. Thanks for the thorough explanation!

ahosier commented 4 months ago

This was fixed as part of the 1.5 release.

w-pearson commented 4 months ago

Confirmed fixed on Windows with RadeonDeveloperToolSuite-2024-04-18-1396.zip. Thanks!