How to render alembic curves/hairs from Houdini with this hack

Hey friends,

We are currently having a project in which we simulate hair in Houdini and want to render it in Blender.
In general the issue is importing animated alembic curves and then render them in Blender with the new curve data block.

Now many of you who already tried to get this to work might know it’s not that straightforward.

There are a couple of obstacles along the way.

Hopefully this whole process should be a lot easier once:
D11591 - Alembic: import arbitrary attributes
D11592 - Alembic/USD: use geometry sets to import data
are merged in master.

But for people who want to get something working before that, here is a little overview.

Using Blender 3.3.0 Alpha with new Curves type enabled (in Experimental settings tab)


Obstacle 01 - Importing Curves
Problem: Importing an alembic cache that contains curves seems to work in the viewport but when starting a render the cache always jumps back to the first frame or rest pose and essentially does not get evaluated. There are a couple of reasons for this which you can read through in this task:

Solution:
We know alembic curves don’t work but what works is alembic polygons. So what we need to do is somehow convert the curves in houdini to polygons, import them to Blender as a regular alembic cache and then convert them back to curves.

  1. Convert houdini curves/polylines to polygons with the ends node. This node basically just connects the last curve point with the first one and creates a ngon.

  2. Import that alembic file into Blender (here you can already verify that this cache renders at any frame as expected)

  3. Add a geometry node modifier with a node tree that does the following:

We convert Mesh to Curve and by using the Set Spline Cyclic node with Cyclic turned off we basically undo what we did in houdini and delete the connection between the last and first point.
Note: It seems like in some cases it deletes the wrong edge, input is welcome on how the debug this.

As a result we now have actual curves that don’t jump back to their rest pose when trying to render them.

But how do we render them?


Obstacle 02 - Render Curves:

Problem: Trying to render our converted curves now does not work. They don’t show up. In the background those curves are still stored in the old data block. What we want is the new curve data block so we can use nodes like the Set Curve Radius node and affect how our curves are rendered.

Solution:
In order to ‘convert’ those curves to the new curve data block we create an empty hair object, add a geometry node setup and just reference our old object with the converted curves in to the new empty hair object geo node tree. That way we use the new curve data block. You should also immediatly see a change in the viewport how the curves are displayed.

  1. Create empty hair object
    new_hair

  2. Add geometry node setup, Object Info converted curves object and connect to output. Set Curve Radius and Set Material.

  3. Render!


Hopefully that helps someone who has the same issue right now.

Cheers!

21 Likes

Wow-thanks SO much for this walkthrough. I’ve just tested and it’s a hack that’s working so far. I’d been beating my head against a wall for a while on this problem, hoping that someone would crack this. Much appreciated :slight_smile:

1 Like

No problem! Glad it helped.

Just keep an eye on the deletion of the edge with the Set Spline Cyclic node. I hade issues that for some ngons it would delete the wrong edge :slight_smile:

Thanks SO much for this tutorial! I’ve been using this approach for a few monhs actually, but always great to hear other people still care about this problem. I did have a lot of issues with Set Spline Cyclic node deleting the wrong edge, so I think what I did instead is to export curveu attribute from Houdini (via vertex colors) and then deleting the vertices with curveu smaller (or larger) than some near-limit value such as 0.02 or 0.98 in order to force the deletion of correct edge (although in that case I lose the first or last vertex of the curve too, so it’s not perfect neither).

1 Like

Hey @nikokoneko,

thanks for your input on the ‘wrong edge deletion’ problem. Realy interesting approach you found there! I think at this point it would be worth contacting one of the geometry nodes devs and find out what’s wrong with the Set Spline Cyclic node. (winking at you @jacqueslucke :smiley: ). Maybe I’ll have time to do some tests soon and find out more.

To be honest I could not figure out if the problem was in the Blender”s SetSplineCyclic node or Houdini was not closing all lines correctly. Looking at the errors I couldn’t find the common thread between them to deduce where the problem could be.

The node is only setting the “cyclic” attribute on the curve so nothing could go wrong in the node really.

This should give the same result:

bild

One can use a sequential .abc export in Blender to deal with the Alembic curve cache bug. The workaround by the OP is not ideal, however it is a good to have solution.

1 Like

Hey, really helpful explanation on how to get the hair across from houdini, however i dont understand how you managed to get the hair to stick to character and have physics like you show in the video, i also cannot manually sculpt the hair for some reason either.

Is alembic unable to store just plain edges? Or why is that houdini curve to polygon there?

Yes. I think if you export a plain edge from houdini it automatically gets converted to curves.
Maybe it’s also the Blender side that interprets that as a curve. Not 100% sure which one is the issue.
And then you run again in to:
Obstacle 01 - Importing Curves (as described in the thread)

2 Likes

In my case at least, the extra edge was always between the vertices with the lowest and highest indices of the face. So instead of making the curve non-cyclic, I removed that edge before converting from mesh to curves. Seems to work well.

4 Likes

Thank you @SamuliPahaoja this workaround is flawless!

1 Like