35
$\begingroup$

Here's a nice, strangely familiar hat. It's rigged with three bones.

rest pose

Let's say I want the hat to fall like a real hat would, and bounce around when the character which it's attached to moves. I could always do it manually, but that's no fun.

fallen pose

Is there any way to do this using Blender's physics system? I've seen some pretty clever jiggle-bone stuff using Bézier curves, Spline IK, and soft-body physics, but I've not found any way to make the curves act like a hat would, even after hours of playing with the settings.

$\endgroup$
  • $\begingroup$ Maybe parent the outer bone to a cloth simulation $\endgroup$ – Faceb Faceb Nov 8 '15 at 10:37
  • $\begingroup$ @FacebFaceb The question is: how to parent a bone's root and tip to mesh verts? I have only been able to find this so far. No definitive answers as far as I know. $\endgroup$ – Mentalist Nov 9 '15 at 17:06
  • $\begingroup$ Ok, sorry, I misunderstand :) I thought the question was how to make the mesh bounce realistically $\endgroup$ – Faceb Faceb Nov 9 '15 at 17:13
  • 1
    $\begingroup$ I haven't tried this, but you could use the techniques taught in this tutorial cgcookie.com/archive/creating-ragdoll-rigs to make the hat act as a rigid body. $\endgroup$ – Nathan Craddock Nov 9 '15 at 23:44
49
$\begingroup$

How to make a cloth sim rig

The trick is getting the bones of your armature to follow the vertices of your cloth mesh. This can be achieved by parenting Empties to the verts and then setting those Empties as IK targets.

1. Make a mesh and give it a Vertex Group for cloth Pinning

The mesh is extremely simple - just a chain of edges, made in the shape you want your armature to be in its rest position.

Creating a vertex group for cloth pinning and assigning weights

Assign a vertex weight of 1 to the base vertex because the cap needs to stay pinned on the head and not fall off. Assign less and less vertex weight as the vertices get further from the base and closer to the tip. My cloth object has only three edges and four verts, so I assigned weights of 1, 0.5, 0.33, 0.15 (from base to tip). Pinning the cloth object with weights allows the hat to be more cloth-like in some areas (the tip) and more rigid in others (the base).

Add a Cloth Simulation to this mesh object. Simulation Context Button

In the Cloth Sim settings enable Pinning and choose your "Pinning" vertex group.

Pinning enabled

Play your scene's animation to check that the movement of this skeletal "cloth" is alright. Grab and rotate the object while animation is playing to see the effect.

2. Add Empties and parent them to the cloth's vertices

Add an Empty for each vertex except the base one. Use Snapping (ShiftS) to position them exactly where the vertices are (while in their rest position, frame 1).

If you want to change the Display Size of your Empties this can be done from the Empties Context. Empties Context

First select an Empty, then Shift-select the cloth object, Tab into Edit Mode, select only the vertex that is to be the parent, and press CtrlP to make it a Vertex Parent. Repeat this process for each Empty. The location of the vertices now determines the location of the Empties.

Creating Vertex Parents for the Empties

3. Add an armature

Create a bone for each Edge of the cloth object's mesh. Snap the roots and tips of each bone to the vertices of the cloth object.

4. Add an IK Constraint to each bone

In Pose Mode select a bone and then click the Add Bone Constraint drop-down button to choose Inverse Kinematics. Set the Target for the IK Constraint to be the Empty which lies at the tip of that bone. Set the Chain Length to 1. Repeat this process for each bone.

Adding an IK Constraint to each bone

Test your animation again and make sure the bones of the armature are moving with the cloth object.

You should have a rig that looks something like this:

The cloth simulation rig

5. Model the hat if you haven't already, and do some parenting

Parent the hat object to the Armature and choose Automatic Weights.

Parent the Armature and the cloth object to the character's head so that they will move with it.

Adjust the hat's vertex weights in the Weight Paint Editor if necessary.

End result:

Demonstration of a rig controlled by cloth sim physics

$\endgroup$
  • 2
    $\begingroup$ amazing! thank you for the example file... :) $\endgroup$ – m.ardito Nov 10 '15 at 17:41
  • 2
    $\begingroup$ Oh, goodness! This looks gorgeous on my model. I'll try to post a gif when I render it. $\endgroup$ – Poyo Nov 10 '15 at 22:06
  • 3
    $\begingroup$ Here it is! gfycat.com/CooperativeLividChicken $\endgroup$ – Poyo Nov 11 '15 at 19:49
  • 1
    $\begingroup$ Excellent solution. Helped me out, too. Thanks!! $\endgroup$ – Jesse Mar 23 '16 at 0:41
  • 2
    $\begingroup$ You can use vertex snapping so it's quicker to create the empties and bones. You can also use Copy Transforms + Damped Track on each bone instead of IK, which is faster (especially if you had left your IK with default 500 iterations). $\endgroup$ – R. Navega Jul 17 '18 at 10:18
10
$\begingroup$

I did a simple setup similar to what I understood you are trying to achieve. Or at least can point you in a right direction, hopefully.

enter image description here

$\endgroup$
  • $\begingroup$ Wow, this opens up a lot of new possibilities! I don't know much about rigid bodies. I have questions... Why is the upper cube passive and the lower one active? What's the reason for the high stiffness and high damping translation? What's keeping it from also moving side-to-side - and can it be made to move in all directions? $\endgroup$ – Mentalist Nov 10 '15 at 13:25
  • $\begingroup$ I just came up with this to find some help fpr the OP, I didn't experiment much about "moving" it later, but maybe parenting would work. the two cubes are needed to use the spring rigid body constraint, afaik, which mimics the bounciness the OP was seeking for, if I got it right. There may be other/better ways, I think. $\endgroup$ – m.ardito Nov 10 '15 at 13:29
  • 2
    $\begingroup$ After seeing how your rig uses an Empty as an IK target I had a realization, did some testing, and came up with what I believe is the ideal way to do this. I will post that answer now. Thank you for the inspiration! $\endgroup$ – Mentalist Nov 10 '15 at 15:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.