Hazeron Forums
Computing obstruction volumes slow for large designs (or small ones with large AABB) - Printable Version

+- Hazeron Forums (https://hazeron.com/mybb)
+-- Forum: Shores of Hazeron (https://hazeron.com/mybb/forumdisplay.php?fid=1)
+--- Forum: Bug Reports (https://hazeron.com/mybb/forumdisplay.php?fid=17)
+---- Forum: Prerelease Bug Reports (https://hazeron.com/mybb/forumdisplay.php?fid=21)
+---- Thread: Computing obstruction volumes slow for large designs (or small ones with large AABB) (/showthread.php?tid=2467)



Computing obstruction volumes slow for large designs (or small ones with large AABB) - Raymoo - 09-16-2020

Not a bug report per se, but a performance complaint. However, after testing the design I posted in this post, it seems like the computed volume can also be very wrong.

It seems like the time it takes to compute obstruction volumes scales up to the volume, regardless of the actual number of faces, which does not have to be high (for example, you could have a very large tetrahedron). Iterating on a very large design is time-consuming when it takes several minutes to enter preview mode. Actually it's scaling up with extents and not volume; the performance issue mainly comes up in the use case of high volume ships, but even this 1600m^3, 454 byte file design takes a very long time to compute obstruction, because it is rotated so that its bounding box covers all three dimensions: http://arcana.moe/lagstick.SoH

I can only imagine that every single unit cube within the design extents is being individually tested for being in the hull. I don't know the real details of how the designer computes obstruction, and I know you have to handle many inexact cases, like hulls that intersect each other or which are not properly solid. But I really really hope there is some way you can improve the computation time to not scale up so high with volume, because the current performance magnifies the time it takes to fix design issues, like pathing, that require a lot of tweaking and testing in the previewer.

Also it does not even compute volume correctly for that design I posted. It's a 1600x1x1 stick but reports 14m^3 volume.

EDIT: After timing the stick, it didn't actually take as long as the actual design I was working on (the stick took about 1:43). I'm still timing the other design.
EDIT2: The other design, which is 800x761x680, took 8 minutes to compute obstructions. It looks like I was wrong about how it scales up (the stick is reported to be 801x1132x801). The issue still stands about it taking a long time for high-volume designs, though. If I scale down the 800x761x680 to 10% in each direction, it takes just a few seconds to compute obstructions.