| Manage Labels 

Bending Setup

Table of Contents

Bending Setup

There are 3 different kinds of bending in our current engine version. One of them (Main Bending) can be adjusted in the editor only. You can change it with the bending value in the vegetation properties, the higher the value, the stronger tree gets affected by main bending. Please have a look at the sandbox editor documentation for further details according to the bending value for vegetation objects.

  • Touch Bending (Setup 3dsMax)
  • Detail Bending (Setup 3dsMax)
  • Main Bending (Setup Sandbox Editor)

Touch Bending

Setup in 3dsMax

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 detacted in this volume. The plants will be affected in this area later only. It is based on UV instancing. You do the setup for one branch or leaf and it will be the same on all other leaves, that 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.

Simple Touch Bending Setup:

place your dummies with vertex snap, so that they are exactly aligned on the vertex.

call them:
branch1_1
branch1_2
branch1_3

If you want to make a second branch with different mapping name the helpers like this:
branch2_1
branch2_2
branch2_3

You can add more Branches if you need. Just go on with number them corectly. At the moment we have a maximum limt of 32 ropes / bones in the engine.

Using Parents and Childs for bending:

To make a branch depended 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) has to be within the bone's radius of your parent branch. Keep in mind that the bones / ropes, will be generated ingame always between two dummies, which you placed in 3dsMax 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 helper is intersecting with another "branch line". (two linked brach helpers)

You can use "p_draw_helpers 2" in the console command line to debug touch bending in the editor. There is no way for artist to tweak the bending itself. Contact Programmer for this.

Detail Bending

Information

The detail bending on vegetation is caused by the wind setup in the scene. The amount of influence of the wind on an object is controlled via vertex colours. Detail bending for vegetation is a shader specific functionality which is currently available for the Vegetation shaders. It is some sort of vertex bending combined in RGB channel within the vertex colors.

Below you can see an example of vegetation objects influenced by wind.
(left:) without detail bending (right:) with detail bending (the playback speed is not realtime).

Basic Setup

Detail Bending needs only minimal setup.

  • Apply a material to the foliage with the Vegetation shader enabled.
  • make sure the distribution of polygons on the bending geometry is somehow regular

  • irregularly tessellated geometry will cause visual artifacts later:

  • set up vertex colors to control the detail bending
How Vertex Colors affect Detail Bending

All three channels are used to control the movement of the geometry.

Color RGB Value Influence
Red 100/0/0 irregular bending at the outsides - movement of smaller shapes
Green 0/100/0 delays the start of the movement - use to create variations
Blue 0/0/100 bend the leave up and down - moves the big shapes

NOTE: Due to the fact that all three channels have different influences, it is crucial, that they are viewed and edited separately.

Setup in 3dsMax

Before we start any painting, we have to make sure that we got a clean tessellated mesh. If this is done we have to turn on Vertex Channel Display in Object Properties. Now our object looks like it got no shading. To sea only the vertex color we put on a white material.

Now we assign the first vertex color modifier and paint the hole object black. The first modifier is for the up and down movement of each leaf. For this we use a clear blue. Its very important that we got a 100% clear blue without any red or green. 255 blue means that we got no bending here. 0 blue means strongest bending. So for this object we can select the middle vertexes and turn on soft selection in vertex paint menu. We choose a value so that we got a soft selection all over the object by only selecting the middle vertexes.

Now we give a 255 blue on this selection and got this result:

Now we assign a second vertex color modifier which is not regular bending on the sides of each leaf. First we paint all black again. Than we select the outer vertexes of each leaf and paint them 255 red which means here is maximum bending. Than we take the vertexes one more inside and give tham a 128 red for lower bending. To get some more variations in this bending we can take some outer vertexes and give them a 220 red. The most important is, ceaping the middelline total black and use only pure red

Our last color is green. We assign a new vertex color modifier ( don't collapse the other two)and got to element mode. Now we select our first leaf an paint it green 255 green (again only green, no red nor blue). Than paint the next leaf 220 green, next 190, next 170 and so on. its not important to have exact values, just make sure you use a lot of different greens. This color tell the leafs to start bend in different times, so not all together going up and down.

If this is done we set the red and the green vertex paint modifier to "add" mode in the vertex paint dialog. To get this result:

The last step in 3D Studio MAX is to save your work and export the file. Make sure you have a backup before you collapse the stack so you can change if something is wrong in the vertex colors.

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

    << Back To CryDev