Clothifying hair
Cloth simulation might be a way to turn Conforming Hair into Dynamic.
Luka Hair, by SWAM (2012). Conforming hair strokes can be turned into dynamic by treating them like cloth. This make them bounce in animation, and swirl in the wind. |
The large amount of fine hair strokes might bring a lot of work when I’d like to clothify them all (separately) but the fine structure might work out quite well in not too extreme conditions.
And… why should I clothify all strokes, perhaps I can do with the top ones only.
A Chain of Links
In the finishing part of this tutorial, I’ll make a swaying chain of iron links:
The links themselves are simple Torus primitives, which I shrunk a bit, opened up (zScale 50%, fatness 0,1) put in a row and I rotated the even ones a bit as the objects could not intersect:
This started the journey along the ways that could turn this series of links into a swaying chain. I will tell you about the mishaps first, and finish with a reasonable successful one.
Simple Clothifying
I open Cloth Room, start a [New Simulation…] and use [Clothify…] on all links 1..9, while the first (leftmost) link #0 is marked a collision object using [Collide Against…]. The alternative is clothify that one too but to put it completely in a choreographed group (which will freeze it, as I did not apply any animation on it).
The idea is that the links will fall (except #0) and each link 1..9 is stopped doing so by the link next to it. As all clothified links are considered pieces of the same one cloth, I’ll need to check the Cloth self-collision option in the [Simulation Settings…].
I also must turn the clothified links into steel ones: stiff compared to their density (mass), and dense compared to the world around them. So I raise the various Resistances to their max, while reducing Air Damping considerably.
When running the sim, I found out it did not work. The first clothified link did stick to the collision object link left to it but the chain broke at the next link. This means that the chain is moving too fast for the simulation to handle the collision, and pumping up the Steps-to-Frame settings in the [Simulation Settings…] is actually the only way out. But to what extent?
The image above shows the result of Steps set to 128 (the sim takes 10 sec/frame) and further testing reveals that Steps set to 512 (40 sec/frame calculation time) only improves the result a little bit.
Altering the collision parameters has no effect, as these concern the interaction between the clothified objects and the collision objects only. And the breaking chain shows that the issue is in the interaction between the clothified objects themselves.
So, this is not the way.
The Helper Object
My next attempt introduces a simple, long and small cloth plane: the Stripe.
I put the leftmost vertices in a Choreographed group to fixate the Stripe in space, and I gave it the maximum Resistance parameter values similar to the steel links, except for Folding to prevent it from behaving like a steel plate.
Then I ran the sim calculations and found out I needed say 600 frames to give a full right-left-right sway to this stiff object.
Now the question was: how do I connect the steel links to it? I can
- Parent them to it
- Attach them as (hard) decorated groups
- Constrain them to it
Parenting the Links
So I made the Stripe the parent object for all Link objects. Would they follow the movements of the Stripe?
No, they did not, for a simple reason. Parenting implies that the rotation, scaling and displacement of an object as defined by its local origin and axes follow the same of its parent object defined by its local origin and axes. But… the sim calculations do not rotate, scale or displace the Stripe object as such. They produce a morph, displacing all the individual Stripe vertices relative to the Stripe’s local origin and axes, but the local origin is left untouched.
As a result of that, the Link objects are not going to move either. This is not the way.
Decorating the Stripe
Now I used the sim for the Stripe, added all Links to it while clothifying them all. Then I put all vertices in a (Rigid) Decorated group, for each Link. So, actually the sim works on the Stripe, and the Links were expected to follow.
Well, in my simple test they did not. The point is, a piece of cloth and its decorations are expected to be one 3D mesh. They should not share vertices not should assigning vertices to the Decorated group leave holes in the cloth, but there should be some edges in the mesh connecting them. Like a button on a jacket: both are separate but a little thread stitches them together and prevent the button from falling off.
In this case, the stitching thread is missing. The Stripe and the Links are separate objects, and there are no edges connecting vertices of the one to the other.
Constraining the Links
To prevent the links from slipping along the strip I raised the Frictions, and while I kept on having issues with links snapping off, I solved them by raising the Collision Depth (and altering the other settings as well)
Of course the sim had to be as long as the movements of the chain stripe (600 frames). As I kept having links with intersecting polys (not believable for steel), and snapping off during the sim, I checked the other options and started raising the Steps per Frame. Simple: the intersecting objects suggest that the speed at which they collide is too high to handle, so I have to consider smaller steps in the sim or: more steps per frame.
I ended up at 128 steps per frame. Each frame required about 40 sec to calculate with this amount of steps and all options switched on. Times 600 frames make 24,000 sec = 400 mins = about 7 hours. I do have a fast machine (i990 @4GHz) but this was a typical overnight run.
The result is okay, at least for the first 400 frames. From then on the links suffer noticeably from being clothified: they start getting a deformed shaped in quite an un-steel like way. But anyway, this ‘constrained to the stripe’ seems to be a promising approach. Wild and large chain movements might need some more elaboration, by my girls can wear a chain for a belt from now on. Simulate a normal cloth stripe (belt) first, then constrain the links to it and simulate the links.
For rendering, I gave the links a rough greyish material with some shine to suggest a rough steelish feel, and I made the stripe itself invisible as it’s a helper object after all.