Detail Bending

Overview

Detail bending on vegetation is the procedural movement of foliage, caused by wind or other physical setup in the scene. The amount that the wind influences an object is controlled by vertex colors.

Detail bending for vegetation is a shader specific functionality which is currently available for the Vegetation shader.

Below you can see an example of vegetation objects influenced by wind (the playback speed is not real-time):

Without detail bendingWith detail bending

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 somewhat regular:


Properly tessellated geometry.


Irregularly tessellated geometry will cause visual artifacts later.

  • Set up vertex colors to control the detail bending

How Vertex Colors Control 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 - used to create variations.

Blue

0/0/100

Bends the leaves up and down - movement of the big shapes.

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

3ds Max Setup

Before starting any painting, you have to make sure that that you have a clean tessellated mesh.


This is wrong. It's too irregular and will break the bending.

If this is done you have to turn on Vertex Channel Display in Object Properties. Now the object looks like it has no shading. To see only the vertex color, put on a white material.

Now, assign the first vertex color modifier and paint the whole object black. The first modifier is for the up and down movement of each leaf. For this use a clear blue. It's very important to have a 100% clear blue without any red or green.

255 blue means that there is no bending. Zero blue means the strongest bending. So for this object, select the middle vertexes and turn on soft selection in vertex paint menu. Choose a value so that you get a soft selection all over the object by only selecting the middle vertexes.

Now give a 255 blue to this selection and get this result:

Now, assign a second vertex color modifier which is not regular bending on the sides of each leaf. First paint all black again.

Than select the outer vertexes of each leaf and paint them 255 red which means there is maximum bending.

Than take the vertexes one more inside and give them a 128 red for lower bending.

To get some more variations in this bending you can take some outer vertexes and give them a 220 red. The most important is, moving the middle line to total black and using only pure red.

The last color is green. Assign a new vertex color modifier ( don't collapse the other two)and go to element mode. Now select the first leaf and paint it green 255 (again only green, no red nor blue).

Than paint the next leaf 220 green, next 190, next 170 and so on. It's not important to have exact values, just make sure you use a lot of different greens. This color tell the leaves to start bending in different times, so they do not all move up and down together.

When this is done, 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 3ds 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.

Maya-Specific Setup

  • Vertex coloring can be fairly simple in Maya, you can use either the Vertex Color tool or the Apply Color as well.
  • It has been noted that having vertex coloring on multiple meshes per export node has been known to give RC errors. If you are experiencing this you can try merging the meshes to eliminate this.

Detail Bending in Sandbox

In Sandbox, enabling detail bending requires only minimal effort:

  • Make sure that wind is enabled. You can do this under RollupBar -> Environment. Please see the Setting Up Weather Effects tutorial for more information on setting up wind.
  • Place the asset as a vegetation object. Detail bending will be turned on by default.
  • Also, make sure that leaves do not belong to one node.

Dummies need to be exactly on the vertices of the leaves. Sandbox uses the UV mapping as a reference for leaves which are used for touch bending later on. Therefore helpers must be snapped exactly.

Also, the material which is supposed to be rendered must not be physicallized.