The Interactive & Immersive HQ

WTF is Convex Decomposition?

What a term! Convex Decomposition! It’s meaty! It’s weighty! Why do we even need this word? Well, it’s a term you’re going to need to know if you’ve completed our TouchDesigner tutorial for beginners and want to get into more advanced TouchDesigner physics workflows in your projects. So let’s skip the chatter and dive in!

The meaning (…of life?)

Convex decomposition is the process of turning a single concave hull into multiple convex hulls. Quick definition check for convex vs concave hull:

convex decomposition

For concave, think bowls or funnels. For convex, think flatter surfaces and bumps.

The problem here is that bullet dynamics, the library implemented into TouchDesigner, and concave hulls don’t play nicely together. There are some less-than-ideal ways of making it happen in TouchDesigner but they’re limited to static objects and not really as flexible as I’d like and on complex models it can just downright not work.

The solution is a process called convex decomposition. This is when you take a surface, like the inside of a bow, and rebuild it using a ton of convex surfaces instead. Once the object is remade out of only convex hulls, then you immediately go back to using dynamic collision shapes in your TouchDesigner physics project.

What’s hard about Convex Decomposition?

In TouchDesigner, because physics is still new and just starting to getting it’s feet wet in our projects, we don’t have some of the more advanced aspects of the workflow. One of these is an algorithm called HACD, which is short for Hierarchical Approximate Convex Decomposition, written by Khaled Mammou and made open source for all to use. It’s actually pretty amazing how effective it is. Take a look at this example:

convex decomposition

A few easy places to notice it working are around the eyes, cheeks, mouth, and ears. Normally those concave regions would provide issues for the collision shape creation. So most convex decomposition tools that you’re going to find online are based on Mammou’s HACD methods. Without this method you have to go through the awful experience of manually trying to make a collision shape for a concave geometry by hand using things like a bunch of boxes that connect with each other… which is less than fun…

And since we don’t have this kind of functionality natively inside of TouchDesigner as the moment, we have to turn elsewhere to fill this need in our TouchDesigner physics projects.

Solutions

Luckily there are a lot of different solutions that are solid and easy to implement into your TouchDesigner physics workflows.

They all essentially work around the same process:

  • Bring your model into a proper 3D modelling software
  • Run a HACD plugin on your 3D model
  • Export the decomposed model from the 3D modelling software
  • Import both models into TouchDesigner
  • Assign one as the collision shape, and use the other as the rendered model

Done and done! But how about some more specifics?

Get Our 7 Core TouchDesigner Templates, FREE

We’re making our 7 core project file templates available – for free.

These templates shed light into the most useful and sometimes obtuse features of TouchDesigner.

They’re designed to be immediately applicable for the complete TouchDesigner beginner, while also providing inspiration for the advanced user.

Houdini Convex Decomposition solve

Houdini has an amazing SOP operator called…you guessed it…Convex Decomposition SOP. Run you geo through it and export.

Blender Convex Decomposition solve

Bless Blender and all their recent improvements. What’s not to like? Blender has a solid and easy to use plugin that does the HACD quickly and easily. It’s a plugin you can install quickly and get up and running with it.

Other solves

If you’re a user of Maya, C4D, or other packages, the best thing you can do is spin up a quick web search that combines the name of the software you want to use and either HACD or convex decomposition. You should be able to quickly and easily find a solution in your favourite 3D software.

Wrap up

Convex decomposition is now a process you understand and a fancy term you have in your back pocket when you’re at parties and looking to impress. It’s a critical part of the pipeline when working on more complex TouchDesigner physics projects. Without tools like the plugins that implement the HACD algorithms, you’ll be really limited in terms of what kind of collision shapes you’ll be able to use in the simulation. Thankfully for us, there’s lots of other packages that can fill this need for us in the meantime until we hopefully get our own Convex Decomposition SOP!