hairgen node, number of hairs changes each frame.

   1477   2   0
User Avatar
Member
4 posts
Joined: 5月 2019
Offline
What I have is a set of animated curves that I'm using for guides and an animated skin. I'm trying to improve the appearance of some existing hair animations for use in unreal, which is where the curves came from, an existing alembic cache. What's important is that the guides are referenced from this and the number of guides doesn't change throughout the animation, so far so good.

The hair generation from this looks great, but since the hair gen node by default, scatters its points onto the skin surface, this means the numbers of actual hair strands is liable to change throughout the animation. I mentioned I'm exporting and rendering this in Unreal and it is really picky about groom cache topology and will reject a file if the topology is not constant throughout all frames. I need some way to force the same topology throughout the whole sequence. What I have tried so far

A) setting the density override to skin attr and using the skins uv attribute, read somewhere that would do it but no dice. Tried it with the UVs as either a vertex and a point attribute.
B) Using static generation, all methods would only cause the points on the scalp to move, the rest of the hair stayed at the first frame position
C) Reworking the entire approach and using a guide deform to manually deform a static hair groom, this produced ugly results and gave me a strange issue where the deformed curves could not be stored in a file cache or output as an alembic. Those specific strands curves just don't get included in the file at all, but the guides do, tried a clean SOP, that didn't do anything. I could see all the curves in the node directly above a ROP alembic or file cache, but trying to store them in anyway skipped the strands. I checked the point numbers and they were all unique.
D)remeshing the scalp to give me a dense, random distribution of points, diving into the hair gen node itself, finding what I guess is the hair gen v1 node that's tucked away inside the hairgen v2 node and setting its mode to per point vs scatter on surface. This lead to very ugly results. the hairs spawn in straight lines counter to the actual point positions on the newly remeshed scalp and a big bald spot on the front.

This problem is making me pull out my own hair.
User Avatar
Member
4 posts
Joined: 5月 2019
Offline
An update. When setting the density to a total number, something that didn't work for me either so I neglected to mention it, I should have paid more careful attention to the primcount vs pointcount. In terms of primcount it works as expected, giving me a stable number of prims. The POINT count is what changes, which is another thing Unreal doesn't like. So what's happening is that as a new prim is created on a frame, it may get assigned to a different guide than the same primnum had been assigned to in a previous frame. Since each guide has a varying number of points, and strands get their point count from the guide they're assigned to, that's what's causing the total pointcount to be all over the place. I don't really care if the strands sometimes jitter in position here and there, a given prims position seems relatively stable in my tests, and out of 120,000 curves the occasional shuffling around of prims isn't noticeable.

What I did was resample the input guide curves to have the same number of points each, apparently disabling max segment length did it for me, though sometimes that just clips the curve, couldnt tell ya why it didnt clip the curves this time but whatever. Combined the generated strands with the guides, marked the prims with the appropriate attributes for unreal and BAM, I'm now getting a rock solid number of points and prims for each frame and Unreal has happily imported them.
User Avatar
Member
618 posts
Joined: 8月 2008
Offline
make sure you skin have rest.

is the same as if you scatter after geometry, hair will scatter first and then move the points base on the rest vs animated
  • Quick Links