Unfolding A Mesh

Unfolding A Mesh

in

A while ago I’ve come across a beautiful blog named houdinigubbins.com. For a coding and mathematics enthusiast, this blog is one of the gold mines one can stumble. I would love to give credit to the creator of the blog, but not much info is given about the  author.

Anyways, mesh unfolding was one of the posts I’ve read and thought I should implement such system to test my skills. Since the author didn’t provide an example file,  I’ve tried to come up with my own solution.

Ok. Back to unfolding!

The main pseudo-algorithm to unfold a mesh is as follows: 

Compute the dual of the polygons.

Create a spanning tree that connects every dual-primitive.

Find children and parent of a primitive.

Find the angle that a primitive needs to rotate to be planar with its parent.

Cumulatively rotate every children of every primitive. 

I won’t explain the implementation of every step, but will provide a .hip file at the bottom. You can examine and try to understand where each step corresponds to. 

Update: As of Houdini 17.0 and greater, pointprims VEX function now returns the primitives in ascending order. In lower versions it was in descending order. This affects the computation of recursive Vex snippets. The hip file is updated according to this change.

I’ve learned so many new techniques and algorithms, trying such a simple thing as unfolding an object. For example, I wasn’t aware of the limitation that, If you change the value of an attribute with setpointattrib function, and later read it, it will default to original. That’s why I used a for loop to cumulatively change children primitive positions, and not use a for loop in attribute wrangle.

Also, you will see that for complex objects the unfolding mechanism fails miserably. Houdinigubbins implies using a routine to check for intersections and rebuild the spanning tree but I didn’t implement it. It may be a nice practice to tackle this issue and I think it probably needs using intersect() function. 

If you would like an example file you can purchase the Houdini file below.

Houdini Unfolding on