svg3d
svg3d copied to clipboard
back-to-front sort should use occlusion ordering
The current "sort by centroids" strategy is not robust, instead we should use a BSP as described in RTR 3rd ed section 14.1. This is what the old-school games like Doom did instead of z-buffering.
See this screenshot for an example of an issue that this will fix (gltf branch).

The main problem with a BSP approach is that splitting is inevitable for scenes like this. Splitting might be acceptable for fill-only styles, but we'd like to allow clients to use stroke.
Instead of a BSP, it would be great to use a non-splitting visibility sorting algorithm, such as the one described in Visibility Sorting and Compositing for Image-Based Rendering by Snyder and Lengyel (attached).