c-d-a / io_export_qmap

.map exporter for Blender
GNU General Public License v3.0
84 stars 18 forks source link

[Feature request] Decomposing concave meshes into convex automatically #11

Closed motorsep closed 1 year ago

motorsep commented 1 year ago

Would it be possible to add functionality that would break up marked/selected concave meshes into convex ones (if not on export, maybe as a pre-export function, initiated with a button in the UI or something) ?

c-d-a commented 1 year ago

I'm on record saying that it's beyond the scope. Seems like the V-HACD addon is no longer maintained, but take a look at it anyway, the sheer amount of options should make it clear that doing this "properly" isn't trivial. It's not that hard to brute-force though, except doing this stuff in python gets slow fast. Here's a quick attempt, you can run it on the active mesh with "play" button: convex_decomposition.zip Not sure if I'll add this to the exporter, but I'll leave the issue open for now.

motorsep commented 1 year ago

Thanks a bunch! I'll give it a spin.

c-d-a commented 1 year ago

Fixed the brute-force version a bit (doesn't split up a basic cube anymore). Here it is in addon form: object_convex_decomp.zip I've decided against adding it as a part of the exporter, will instead make a separate repo at some later date. Feel free to report issues here until then. (edit: fixed a couple bugs with loose verts and coplanar faces, replaced link)