V-HACD Tool for creating accurate convex collision meshes for real-time physics in games etc

(Mr_Flamey) #1

Note: This is actually a conversion of an old add-on released for Blender 2.64 back in 2014 by Phymec. You can find the original thread here

Since convex decomposition is incredibly useful for making collision meshes for games, I thought I would spend a few hours getting this old add-on working with 2.80. It takes any old mesh as an input, passes it to an external application for processing, then reimports the resulting convex collision hull suitable meshes back into Blender. Although most game engines support some form of convex decomposition, it’s nice to have full control in Blender, and in any case, the results I’ve seen in UE4 leave a lot to be desired, so it’s best to manually create collision meshes for all but the simplest shapes :confused:

The updated add-on can be found on my Github page

As with the original add-on, you will need to get a copy of the testVHACD executable from the V-HACD github page, or by clicking one of these direct links: Win | OSX (Requires OpenCL), Win | OSX (No OpenCL required). Set its location in the add-on preferences in Preferences>Add-ons>V-HACD and it should all work.

Although I removed a few features to do with physics from the original add-on, mostly due to the removal of the game engine from Blender 2.80, I added a little tool to help with naming generated hulls, so that you can easily use it to name a bunch of generated colliders to work with game engines like UE4 (which uses a UCX_<mesh_name>_# format for colliders) or whatever.

I hope this is useful to some of you guys that might have (like me) missed the original add-on and been a little frustrated with the apparent lack of good convex hull generation in Blender. I’ve wasted plenty of time splitting meshes into chunks by hand, but thanks to the work of Khaled Mammou, Phymec and to a lesser extend, myself, it’s now quite easy to get good results in Blender 2.80.

13 Likes
List of addons that work with 2.8
List of addons that work with 2.8
(ambi) #2

Thank you for this addon to integrate super useful tool. Couple of things: the installation is the .py file from Blender, the .zip doesn’t work. For Windows the .exe for V-HACD can be found at https://github.com/kmammou/v-hacd/tree/master/bin/win64, it doesn’t need to be compiled. Import-Export: Web3D X3D/VRML2 format addon must be enabled.

Also: is there a way for the addon to not also push the surface outward so much?

(Mr_Flamey) #3

Thanks for pointing that out. I forgot that the direct download from github gets nested inside another folder and so won’t work. I’ve fixed the links to a release file instead.

The add-on doesn’t do anything to the convex hulls generated by v-hacd, other than rename them, so I’m not sure what you mean. You might try playing with the settings to see if you can get better results. To be honest, I haven’t used it very extensively and porting the add-on was sort of a Sunday evening hobby thing really :wink:

(Mr_Flamey) #4

Update: v0.35

I’ve released a new version which restores the ability to save operator presets for the main convex hull generator, as well as adding an operator which will select existing convex hulls based on selected objects, so you don’t have to manually select a bunch of objects, which can be fiddly at times.

#5

Hey thank a bunch for this addon it will come in handy very soon for me!

1 Like
(Oxer) #6

I have installed the addon (v0.35) and testVHACD.dms (No Open CL) on macOS 10.13.6 & Blender 2.80.64, when I run the addon with operator search menu, it appears the pop-up window with the options, I press OK but it nothing happens, it appears a message “No meshes to process!” but I have selected Suzanne, see the image.

(Mr_Flamey) #7

I don’t have a Mac to test this on, but I tried to run it on the latest version of Blender 2.80 (2019-05-14) on Windows and couldn’t reproduce the issue. I don’t know why this would happen on your machine and not mine, since checking the selection contains valid meshes should work the same regardless of platform.

(Oxer) #8

I started Blender from the terminal and this is the message in the terminal when I press OK button:

Exporting mesh for V-HACD: /var/folders/l9/c_qtfqf17257pb9ppdy9tw5m0000gn/T/Suzanne.off…

Running V-HACD…

“/Applications/Blender/testVHACD.dms” --input “/var/folders/l9/c_qtfqf17257pb9ppdy9tw5m0000gn/T/Suzanne.off” --resolution 100000 --depth 20 --concavity 0.0025 --planeDownsampling 4 --convexhullDownsampling 4 --alpha 0.05 --beta 0.05 --gamma 0.00125 --pca 0 --mode 0 --maxNumVerticesPerCH 32 --minVolumePerCH 0.0001 --output “/var/folders/l9/c_qtfqf17257pb9ppdy9tw5m0000gn/T/Suzanne.wrl” --log “/var/folders/l9/c_qtfqf17257pb9ppdy9tw5m0000gn/T/Suzanne_log.txt”

/bin/sh: /Applications/Blender/testVHACD.dms: Permission denied

I have placed testVHACD.dms file in the Applications folder inside of Blender subfolder.

(Mr_Flamey) #9

The only thing that springs to mind here is that there might be some incorrect permissions set on the dmg file, preventing it from being launched as an executable by Blender. As I’m not a Mac user, I’m not sure how you would go about changing it, but I do remember that this caused issues for me on a few occasions in Linux.

http://www.macinstruct.com/node/415 < This link might help. This kind of thing helped me solve issues with permissions in Linux.

(Oxer) #10

Thanks for the reply but the file has Read and Write permissions for everyone, the file has extension .dms, it isn’t a .dmg file (disk image on Mac), I don’t know this extension on Mac (I’m Mac user since 1990), the system associates the extension to The Unarchiver, it’s a RAR extractor application for Mac but the applicattion can’t extract the content.
testVHACD.dms isn’t an executable file or that I think.
I found this article https://github.com/kmammou/v-hacd/issues/24 perhaps it can help.

(Mr_Flamey) #11

I’m afraid I can’t really help here. I am not sure what could be causing the issue, and now I wonder if the Linux version also suffers from a similar issue. If I get around to testing it on Linux, I’ll let you know if it works. It would also be great if anyone else using the addon on a platform other than Windows would let me know if it works or not :smiley:

(Oxer) #12

Thanks for your time, I’m in the same point, I suppose that the problem is the missing library and I don’t know how install it. I’ll request help to Rombout, a Thea4Sketchup beta tester (like me), he made some addons for Blender and he is working in Thea for Blender 2.80 now.
I’ll inform you.

Regards!