I've been following https://jacco.ompf2.com/2022/04/13/how-to-build-a-bvh-part-1-basics/ for my BHV implementation and I've encountered a bug that I just cannot for the life of me debug.
Previously, when I was using median longest axis split, my BVH construction would terminate early due to nodes being split such that one of the child nodes is completely empty which caused a lot of triangle dense leaves, not ideal. I thought this might just be a result of always going with median longest axis split and not considering other axes, so I moved on to SAH builder thinking everything would be fixed.
This only ended up being partially true... Now, leaves have at most 2 triangles, as I expected, but something else is going wrong and I think it's linked to the problem I may have had with the old builder. To me it looks like only one of the branches from the root node seems to be splitting properly and I really have no clue how to begin debugging this. I'll attach an image of a heatmap of the node intersections which gives me this impression.
I'd really appreciate any help, thanks!