Blender: Cloth interaction

Adult content

This content is marked as Adult/NSFW content. You can toggle your preferences regarding this content type in your account settings.

Show more

Description

How to animate character grabbing cloth


Updated with rbpny suggestion, now it is better and doesn't need to use interpolation mode: constant; will not create offset by the hook modifier. Doesn't use the hook modifier. Way less modifiers.


Hello everyone, here is a Guide from someone that is bad at explaining stuffs.

A Working Demo file included for blender 3.0. if you open it with an older version of blender, then disable bendy bone.

So please LOOK AT THE GRAPH EDITOR. To see how the modifiers are triggered.


This guide assumes you know:


The simulation doesn't have to start at frame 1 or 0

-Create a proxy mesh or have a mesh with a decent topology for cloth sim.

-Why?

-If some vertices are to close to each other it will explode, ok?

Hook object(empty or bone) need to have child of constraint or some kind of parent child relation depending on the part you want to interact with.

In the video above, the hook is child of the chest bone and 2B IK hand is child of the hook/bone. Using child of constraint.


Vertex groups

Add the following vertex groups(you can name them however you want as long as it works for you and your team(?)):

  1. Vertex group: Pinned; Select every vertices and add them to the group.
  2. Vertex group: Cloth: assign every area that should move with cloth sim.
  3. Vertex group: ClothHook1: assign the vertices where you placed the hook#1.
  4. Vertex group: ClothHook2: assign the vertices where you placed the hook#2.
  5. Vertex group: ClothHookGroup: ClothHook1 + ClothHook2(area with hook modifier)

If you are unsure, you can turn off those modifiers:Vertex Weight Mix(s). And check each vertex group in weight paint mode.


Order of the modifiers and its settings do matter.


MUST USE INTERPOLATION MODE CONSTANT TO CONTROL MODIFIERS INFLUENCE (if you are using hooks).


Modifiers for the Proxy mesh

Add those Modifiers with those setting:

2x Armatures Version(Simple and Better thanks to rbpny):

1.Vertex Weight Mix (1): Pinned - Cloth
- Vertex Group A: Pinned 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: subtract
- Keyframe the global influence: 1 To remove some area; 0 Everything is pinned & controlled by the armature
- Mask Vertex Group: Cloth

2.Vertex Weight Mix (2): ClothHookGroup - ClothHook
- Vertex Group A: ClothHookGroup 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: subtract
- Keyframe the global influence: 1 To remove ClothHook from ClothHookGroup; 0 ClothHook is pinned & controlled by the second armature rig.001
- Mask Vertex Group: ClothHook

3.Vertex Weight Mix (3): ClothHookGroup - ClothHook2
- Vertex Group A: ClothHookGroup 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: subtract
- Keyframe the global influence: 1 To remove ClothHook2 from ClothHookGroup; 0 ClothHook2 is pinned & controlled by the second armature rig.001
- Mask Vertex Group: ClothHook2

4.Vertex Weight Mix (4): Pinned + ClothHookGroup
- Vertex Group A: Pinned 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: Add
- Keyframe the global influence: 1 To add ClothHookGroup to Pinned; 0 To release all Hooks(vertex groups: ClothHook & ClothHook2)
- Mask Vertex Group: ClothHookGroup

5.Armature(1)
- Set the Object:(your character_rig)
- Set vertex group: pinned. it tells the armature to control those vertices in that group.

6.Armature(2)
- Set the Object:(your Hook(s) made using bones)
- Set vertex group: ClothHookGroup and invert it.
- Reason(I'm still confused, but it works), same reason as why we need 2 armatures for custom preserve volume, I guess.

7. Cloth setting:
- set the Pin Group to the vertex group: Pinned
- set the collision to .001(subjective)
- enable the self collision if you have to.
- raise the Quality of the cloth simulation and the quality for the collision if is not stable.

8. (Optional) Smooth Corrective

9. (Optional) Shrinkwrap: Outside

Should be easier now, only need to animate the hook_bones and control the influence of a few vertex groups instead of 5+ modifiers


Hook Version(Complicated version):

You can skip the optional part if you only have 1 hook


1. Hook#1: Can be an empty or bone.(go in edit mode to assign vertices, do it in rest mode) keyframe the strength: 1 to control with the hook, 0 to disable hook influence
2. Hook#2(optional): Can be an empty or bone.(go in edit mode to assign vertices, do it in rest mode) keyframe the strength: 1 to control with the hook, 0 to disable hook influence
- When you assign the vertices for the hook modifier, you should do it rest mode. the vertex that you assigned to hook need to be same for the vertex group ClothHook1 & ClothHook2

3. Vertex Weight Mix (1): Pinned - Cloth
- Vertex Group A: Pinned 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: subtract
- Keyframe the global influence: 1 To remove some area; 0 Everything is pinned & controlled by the armature
- Mask Vertex Group: Cloth

4. Vertex Weight Mix (2): Pinned + ClothHook1
- Vertex Group A: Pinned 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: Add
- Keyframe the global influence: 1 to add ClothHook1 vertices to the Pinned Group; 0 to remove
- Mask Vertex Group: ClothHook1

5. Vertex Weight Mix (3)(Optional): Pinned + ClothHook2
- Vertex Group A: Pinned 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: Add
- Keyframe the global influence: 1 to add ClothHook2 vertices to the Pinned Group; 0 to remove
- Mask Vertex Group: ClothHook2

6. Vertex Weight Mix (4): ClothHookGroup - ClothHook1
- Vertex Group A: ClothHookGroup 
- Default Weight B: 1
- Vertex Set: All
- Mix mode: Subtract
- keyframe the global influence: 1 to let the armature to control that area; 0 : Armature can't control that area
- Mask Vertex Group: ClothHook1

7. Vertex Weight Mix (5)(Optional): ClothHookGroup - ClothHook2
- Vertex Group A: ClothHookGroup
- Default Weight B: 1
- Vertex Set: All
- Mix mode: Subtract
- Keyframe the global influence: 1 to let the armature to control that area; 0: Armature can't control that area
- Mask Vertex Group: ClothHook2

8. Armature:
- Set vertex group: ClothHookGroup and invert it. it tells the armature to not control those vertices in that group.

9. Cloth setting:
- set the Pin Group to the vertex group: Pinned
- set the collision to .001(subjective)
- enable the self collision if you have to.
- raise the Quality of the cloth simulation and the quality for the collision if is not stable.

10. (Optional) Smooth Corrective

11. (Optional) Shrinkwrap: Outside

The quality of the cloth sim will depend on your mesh topology, that is why you should use a proxy mesh and add a surface deform modifier or whatever that can do the same thing.

If you want to stop the mesh from shaking, you can save the cloth sim as a shapekey at a certain frame.


The mesh WILL GO BACK TO ITS ORIGINAL POSITION OR SNAP TO THE HOOK, if the pinned area regain its removed vertices.

Reason down below


Cloth with Animated Vertex Groups

Cloth with animated pinned vertices: Regression blend-file. Unsupported: Starting with a goal of 0 and increasing it, but still having the vertex not pinned will not work (e.g. from goal = 0 to goal = 0.5).

[...]because the necessary β€œgoal springs” cannot be generated on-the-fly.

Source: https://docs.blender.org/manual/en/latest/physics/cloth/examples.html


The OTHER INTERPOLATION MODE (Hook modifier Issues)


When you keyframe the Hook & Vertex Weight Mix you should set the interpolation mode to constant, If you used any other method of interpolation, it can cause some offset. In some case the others interpolation is fine for the Vertex Weight Mix, only when you want the cloth sim to go back to its original position or to the hook.


All of this is possible thanks to this: https://wiki.blender.org/wiki/File:Cloth_anim_vertex.blend


https://twitter.com/RenderingButts

Tags

SmutBase is a free service. However, it costs about $0.03 to deliver you a 1GB file. With over 20TB of traffic every month and growing, SmutBase needs your help. If only 1% of our users each gave us $5 for a single month, we could keep the site running for several years.

Filename Downloads Created Filesize
Files
  Pulling_cloth(Updated_with rbpny suggestion).blend   1059 2022-03-05 17:19:02 16.94 MB
  OLD_show_bobs_and...pulling_cloth_demo.blend   881 2022-02-26 19:51:19 16.3 MB
Thumbnail image for Blender: Cloth interaction
How to extract Unity models
Unity is an engine that's used for many games. So how do we get to the models and textures? With some publicly available tools, of course!

Comments (-)

Sorting:

Leave a comment

You need to log in if you want to leave a comment.