A few weeks ago, my friend and co-worker Omar Taher came to me with an issue: he had a hair groom made of triangulated cards, and wanted to extract centerline curves from them to use as guides.
Download the latest release here.
Full repo here.
houdini18.5/hda folder you can grab the HDA and put it someplace
where Houdini will find it. Otherwise, you can install it as a Houdini
- Download the release zip
- Navigate to your Houdini user preferences folder (ie.
- Create a folder called
packagesif it doesn’t exist yet
- Copy the downloaded zip into
- Extract the contents, and delete the zip archive if you want
- Drag the file
cards_to_curves.jsonup one level into to that
There is also a demo file located at
houdini18.5/hip with some usage examples.
See the the help card on the node for more detailed info.
Sounds easy enough at first, but given some wonky polygon winding and shapes, it took a little extra work to make sure it was stable on every card.
At first, not knowing much about how groom artists create hair cards, I took a VEX approach that matched up pairs of points based on their neighbors, and added a point at their center. Unfortunately, that only worked when the cards were made with one row of alternating triangles, and after downloading a few more free hair card grooms, I realized that this method fails spectacularly if the artist created it differently.
Luckily, one thing all good hair card grooms have in common: they have nice UVs! Should have thought of that sooner! This makes finding the centerline a breeze:
- Evaluate the connectivity.
- Split geo by UV seams, and promote
uvattribute to points (if it isn’t there already).
UV, so the points now look like a UV layout, but in world space near the origin in the viewport.
- Iterate over each connected piece (card), and create a line down the center of the bounding box, from the top to the bottom.
- Add some more points to these lines with a Resample.
- Ray the lines to the flattened hair card geo.
- Use an Attribute Interpolate to put them back into world space.
Checkout the hipfile to see the setup, and crack open the hda for a deeper look.
As mentioned above, this node will create guide curves from hair cards.
By default, the tool is pretty straight forward. Plug in the static cards into
the first input, get curves out! As long as you have a
uv attribute (that
works) you should get something useable.
Single Card & Guide Geometry
Enable the Single Card parameter to scrub through the cards one at a time for a quick debugging visualization.
Stick to Animation
If a second input is connected, the guides will interpolate attributes (including position) from that geometry stream.
Make sure the topology matches the original cards from the first input!
If you’re getting bad guides that zig zag, or look like they’re spanning across multiple guides, make sure the input cards are clean. There is a Poly Doctor embedded in the node that should help clean up non-manifold geometry, but sometimes it can’t do all the work! Make sure that any problem cards are actually being treated as separate connected islands per-card. Otherwise either fix them, or delete them!
Enjoy! If you have any problems, please feel welcome to add an issue to the github repo, or reach out to me directly.