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

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.

15 Likes

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?

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:

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.

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

1 Like

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.

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.

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.

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.

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.

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:

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!

I can’t understand what V-HACD it is . Run some times, it looks like remesh , many tris .:joy:

V-HACD is not about remeshing a model to reduce polygons. It takes your model and breaks it down into convex volumes. Convex volumes are often used in video games and physics simulations instead of the original mesh because physics solvers can work much more efficiently on convex shapes.

I would love your updated version for 2.79, since the amazing FBX bundle addon hasn’t been updated for 2.8 yet. having the two together would speed things up a huge amount!

The original version of the addon, by Phymec should still work in 2.79. You can get that version here.

My version of the addon does add a few things to organising the scene though, so the colliders generated by the original addon don’t have particularly great names. However, I’ve not really got time to port to 2.79, but the code for both addons is available if anyone feels like getting their hands dirty. Let’s just hope the FBX bundle addon is updated soon :smiley:

1 Like

physics simulations . I need it .

I suppose to put into Unity3D for AR .

But first I don’t know how workflow for physics simulations .

Later , I’m learning on it.

Thanks reply.

This used to work beautifully with blender 2.79. However the current version does not work with an error listed on preferences. I believe this the python file and RDB wrote this I have searched their website https://pybullet.org/Bullet/phpBB3/viewtopic.php?f=4&t=6619&start=30 and cannot find a workable update for 2.8 blender just 2.2 which is a shame as its fantastic software and too good to be removed by a simple python problem. Can you help , please provide object_vhacd.py.zip which works with Blender 2.8? Thankyou

I just checked it out on a clean install of Blender 2.80, and the last release (version 0.35) is working just fine. Have you set up the path to the v-hacd executable?

Please check the installation instructions here to make sure you have installed it correctly.

Yes Mr Flamey . I had right path setup but in preferences after installing it it had an error “upgrade to 2.8x required”. I could not find the tool box with it in in 2.8 to load the exe into V-HCAD. It also worked with 2.79 beautifully. from the download location you suggested . I have the latest release 2.8 I can download . My friend has the same problem too.