Forest Editor Wind Effects for Artists
by Russell Fincher · in Torque 3D Professional · 06/03/2010 (10:42 am) · 45 replies
Edit: Forest Editor is currently included in the Torque 3D 1.1 beta, presumably to be included in the full 1.1 release. T3D 1.0 owners should have access to the 1.1 betas.
I'm going to add this post as an explanation of how to set up your vegetation model to take advantage of the wind effects in the Forest Editor. This information has been covered in a few other posts, but I wanted to get it all in one place. This post will discuss how to paint vertices of your plant models in your modeling program and set them up in T3D. I'll tweak this over time as I am able to. Please let me know in the comments if there is anything missed or unclear here.
VERTEX PAINTING YOUR MODEL
The color of a vertex in a model allows the artist to specify how a plant model will behave once it is brought into T3D and allowed to respond to a wind emitter. Here is a breakdown of how the colors affect a model:

The red coloring only, to designate the upward/downward bend of the branches... notice how the base of the branches are black and the ends of the branches are red:

The blue coloring only, to designate leaf fluttering... notice how only the edges of the blades are colored:

The green coloring only, to designate individual instances of branch bend... each branch has its own shade of green:

And all the colors mixed together with an additive blend. Notice that the trunk has no coloring, since it will neither flutter like a leaf nor wave like a branch. The bend along the tree's height is done without the use of vertex coloring:

And a video of this in action:
How you actually apply these color sets varies between modeling apps, but here's how I do it in 3ds Max:

If you need to go back and tweak individual color sets/modifiers in Max, you can put their blending modes back to "normal" and turn them on and off to isolate an individual color set.
And I probably don't have to say this, but don't eyeball the colors, dial them in. When I say "red", I mean pure red, or R:100%, G:0%, B: 0%.
EXPORTING YOUR MESH TO TORQUE 3D
I use the free OpenCollada as my exporter (DTS does not support vertex color data). The last I checked, Max's built-in Collada(.dae) exporter wasn't exporting vertex coloring correctly. OpenCollada exports both vertex coloring and User Properties correctly, so it's my Collada exporter of choice. Just be aware that it appends material names with "-material". I can't get those guys to agree with me that it's a terrible idea.
For those not using Max or Maya who cannot use the OpenCollada plugin... you'll just have to see if T3D's Collada importer will correctly read vertex coloring in your file.
SETTING UP A PLANT MESH IN TORQUE 3D TO DISPLAY WIND EFFECTS

Once a mesh is brought into the Forest Editor (and a global wind emitter is placed in the scene), the mesh parameters must be set properly for your plant to come alive correctly. Definitions for mesh parameters:
SETTING THE VIEW DISTANCE OF THE WIND EFFECTS
Plants in the distance will not display wind effects. In the current beta release, Torque 3D 1.1 beta 1, you can change the threshold that wind effects disappear by changing its configuration in the source code. See Tom's comment below about setting that.
In subsequent releases, this can be changed by simply entering this in the console: $pref::windEffectRadius = 30; That sets it to 30 meters around the camera. The default setting is 25 meters. Obviously this will affect performance, but you can cater it to your specs. Make sure to save your level after doing this.
A FEW MORE NOTES ON WIND EFFECTS
In addition to the global wind emitter, you can use a local wind emitter around anything that may create a localized wind situation... waterfalls, helicopter rotors, big fans, jet engine exhaust, etc.
Also, when setting up the wind parameters for your mesh in T3D, be sure to occasionally toss a grenade near your plant to see how your settings look with an explosion nearby.
Have fun! Make your foliage come alive! :)
I'm going to add this post as an explanation of how to set up your vegetation model to take advantage of the wind effects in the Forest Editor. This information has been covered in a few other posts, but I wanted to get it all in one place. This post will discuss how to paint vertices of your plant models in your modeling program and set them up in T3D. I'll tweak this over time as I am able to. Please let me know in the comments if there is anything missed or unclear here.
VERTEX PAINTING YOUR MODEL
The color of a vertex in a model allows the artist to specify how a plant model will behave once it is brought into T3D and allowed to respond to a wind emitter. Here is a breakdown of how the colors affect a model:
- Bending of branches: controlled by the amount of red on a vertex. Normally the ends of branches are fully red, and the spot where they reach the trunk would be fully black (or colorless, depending on how you are painting...see my method below), with a smooth gradation between.
- Branch group instancing: So that groups of branches sway independently, they need to have varying amounts of green. Usually done by selecting a clump of branches/fronds and filling with a random shade of green (anywhere from pure green to black).
- Flutter of leaves: flutter is controlled by the amount of blue on a vertex. Normally, the ends of fronds are fully blue so they flutter fully, but I've found that in a lot of cases (in trees, mostly) I can just fill the entire frond with blue.
- Vertical bend: the vertical bend of a tree does not have to be painted... that is calculated automatically by its height

The red coloring only, to designate the upward/downward bend of the branches... notice how the base of the branches are black and the ends of the branches are red:

The blue coloring only, to designate leaf fluttering... notice how only the edges of the blades are colored:

The green coloring only, to designate individual instances of branch bend... each branch has its own shade of green:

And all the colors mixed together with an additive blend. Notice that the trunk has no coloring, since it will neither flutter like a leaf nor wave like a branch. The bend along the tree's height is done without the use of vertex coloring:

And a video of this in action:
How you actually apply these color sets varies between modeling apps, but here's how I do it in 3ds Max:
- Stack three separate Vertex Paint modifiers on the tree model.
- Working from the bottom, one modifier at a time, fill the vertices with black, then paint one of the color sets listed above to each of the three modifiers. In the end, it doesn't matter in what order the colors are created or stacked.
- After all three have been painted their own color set, set the blend mode of the top two Vertex Paint modifiers to "additive".
- Export your model as Collada with these modifiers on and you should have the vertex coloring you need to get wind effects on your meshes. Do not collapse the stack.

If you need to go back and tweak individual color sets/modifiers in Max, you can put their blending modes back to "normal" and turn them on and off to isolate an individual color set.
And I probably don't have to say this, but don't eyeball the colors, dial them in. When I say "red", I mean pure red, or R:100%, G:0%, B: 0%.
EXPORTING YOUR MESH TO TORQUE 3D
I use the free OpenCollada as my exporter (DTS does not support vertex color data). The last I checked, Max's built-in Collada(.dae) exporter wasn't exporting vertex coloring correctly. OpenCollada exports both vertex coloring and User Properties correctly, so it's my Collada exporter of choice. Just be aware that it appends material names with "-material". I can't get those guys to agree with me that it's a terrible idea.
For those not using Max or Maya who cannot use the OpenCollada plugin... you'll just have to see if T3D's Collada importer will correctly read vertex coloring in your file.
SETTING UP A PLANT MESH IN TORQUE 3D TO DISPLAY WIND EFFECTS

Once a mesh is brought into the Forest Editor (and a global wind emitter is placed in the scene), the mesh parameters must be set properly for your plant to come alive correctly. Definitions for mesh parameters:
- shapeFile - path to mesh
- collidable - indicates whether or not the mesh uses collision
- breakable - (not implemented)
- radius - the canopy radius in meters. This keeps plants from being placed too close to one another and having overlapping canopies. This value may need to be adjusted on larger plants when placing smaller plants under their canopy (placing bushes under a tree, for instance). This has no in-game functionality and only matters when placing trees in your environment.
- mass - mass will generally affect how springy a plant is in response to wind or an explosion. Think of it as a weight on the end of a stick. Most of my trees are set to around 5, smaller plants down to 0.5.
- rigidity - how much the plant resists the wind force. Most of my trees are within 10-20, but some small grasses go down to 1.
- tightnessCoefficient - how much the plant resists bending. Between 0 and 1.
- dampingCoefficient - slows down the sway of the plant so it won't whip back and forth forever. Between 0 and 1.
- windScale - relative scale at which this plant is affected by wind. Between 0 and 1, but will almost always be set around 1.
- trunkBendScale - the amount that a plant will sway from top to bottom. This is very sensitive. I don't have any vegetation set higher than 0.03, and most are under 0.01.
- branchAmp - amount that a branch with sway up and down. Start well below 1.
- detailAmp - the amount of leaf flutter. Start well below 1, in the 0.05 range.
- detailFreq - the speed of leaf flutter. Start well below 1, in the 0.05 range.
SETTING THE VIEW DISTANCE OF THE WIND EFFECTS
Plants in the distance will not display wind effects. In the current beta release, Torque 3D 1.1 beta 1, you can change the threshold that wind effects disappear by changing its configuration in the source code. See Tom's comment below about setting that.
In subsequent releases, this can be changed by simply entering this in the console: $pref::windEffectRadius = 30; That sets it to 30 meters around the camera. The default setting is 25 meters. Obviously this will affect performance, but you can cater it to your specs. Make sure to save your level after doing this.
A FEW MORE NOTES ON WIND EFFECTS
In addition to the global wind emitter, you can use a local wind emitter around anything that may create a localized wind situation... waterfalls, helicopter rotors, big fans, jet engine exhaust, etc.
Also, when setting up the wind parameters for your mesh in T3D, be sure to occasionally toss a grenade near your plant to see how your settings look with an explosion nearby.
Have fun! Make your foliage come alive! :)
About the author
Art Lead at Sickhead Games, focused on dev tools and prototyping, instructor/advisor at several Dallas colleges and universities, Associate Developer with GarageGames, champion of avant-garde game art at uncommonassembly.com.
#42
10/07/2010 (7:25 pm)
you'd have to add that in by yourself as currently only the 'forest' works with wind emitters.
#43
And Konrad's addition is too cool- can't wait for that!
Or is it posted already? (haven't searched)
Thanks a heap to you both.
10/14/2010 (4:15 am)
Need I say it Russell-- you're the man!And Konrad's addition is too cool- can't wait for that!
Or is it posted already? (haven't searched)
Thanks a heap to you both.
#44
02/11/2011 (7:35 am)
amazingly good work!
Torque Owner Kory Imaginism
innovative imaginations