This procedure is for big leaves or branches, which bend on collision. It is a type of bone / rope setup based on UV instancing but newer versions of the engine actually feature a easier to use, more optimized approach known as merged mesh deform. Both techniques should be considered before applying. More information on merged mesh deform can be found at the bottom of the page
Touch bending is a simple rope setup to simulate a physical interaction between the player and vegetation foliage. This method works well for big leaves, with separate stems/branches, as well as bushes.
General Setup Information
Touch bending uses some clever techniques to simplify the setup procedure massively:
Setup of Instances (UV Layout)
The joint setup is controlled by placing helpers/dummies at sensible positions on a "master leaf" and by following a naming convention.
Place the dummies where you would like the branch to start bending, one or more intermediate steps and at the tip of the branch.
The dummy position must be equal to the vertex's position, which they are supposed to animated. The best way to achieve this, is to snap the dummy to the vertex.
The engine interpolates between these dummies with a kind of rope setup and weights all other vertices automatically. Please check the picture below for the null positions.
The system allows for numerous branches (this is how the rope based joints are called) per object. The naming convention is relatively simple:
branch<# of branch>_<# number of joint>
This dummy setup only has to be done once per shared UV Layout.
In the example above it is branch1_1, branch1_2 and branch1_3.
If you want to add another branch with a different UV Layout, just name the dummies for this branch: branch2_1, branch2_2, ..., branch2_4.
3ds Max Setup
You can find a sample file in the Sample Assets Package.
This procedure is for big leaves or branches, which bend on collision. Its a kind of bone or rope setup based on UV instancing.
Your object need a proxy for this which is physicalized as "noCollide". Touch bending will only be detected inside this volume.
You can create the setup for one branch/leaf and it will be the same on all other branches/leaves which share the same UV mapping.
In the first example we have an object using the trunk as position and rotation parent. That means you can't attach a branch to another branch because it would take the trunk as rotation reference.
You need to place dummy objects using vertex snap so that they are exactly on the vertex.
Use the following names for the dummies:
If you want to make a second branch with a different mapping setup, name the dummies like this:
You can add more branches if you need to. Be sure to number them correctly. Set the pivot of your object to worldspace 0. At the moment we have a maximum limit of 32 ropes / bones in the engine.
Using Parents and Childs for bending:
To make a branch dependent on another branch, you have to give your parent another unique UV mapping (should not share the mapping with the childs). In addition your child "branch* _1" dummies (your start dummies) have to be within the bone's radius of your parent branch.
Keep in mind that the bones/ropes will be generated in-game always between two dummies which you placed in 3ds Max before. So you can place the start dummy for your child bone somewhere on the line between two linked branch dummies from your parent branch.
The engine will automatically detect those intersecting bones and creates a parent child setup. The parent branch dummies don't have to start with branch1_*. They could also use branch2_*. It just depends on, if your branch start dummy is intersecting with another "branch line" (two linked branch dummies).
Export your objects like this:
1. Create a group under the 'cryexportnode' named '@_helper' replacing the '@' with the name of your model.
6. To enable the branches to become usable in game you must add a 'bending_proxy' volume that encompasses the extents of the leaves that will be bendable. eg. create a sphere and ensure the branches are on the inside of the sphere.
9. Select the 'cryexportnode' group.
Setup in XSI
Place your object as vegetation. The material needs to be Vegetation Shader with the leaves checkbox turned on.
Merged Mesh Deform
This is a new option for deformable, interactive vegetation, setup is similar to previous techniques but much easier to use. Please visit Cloth Merged Mesh Deform for more information.
The following console variables can be used to tweak the physical behavior of the branches (some of them can also be set on a per-asset basis via UDP keywords, listed in brackets - for instance "damping 10.5")