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.
#2
06/03/2010 (11:23 am)
Adding to official docs for next release.
#3
06/03/2010 (11:58 am)
Made a few corrections throughout the post. Readers, please let me know if there is anything I have left out or if I've made any errors. :)
#4
-THANK YOU RUSSELL!
06/03/2010 (12:02 pm)
I'm using trees a lot in our viking game project, so...-THANK YOU RUSSELL!
#5
EDIT: THANKS! (How rude of me to forget to thank you. Awesome writeup.)
06/03/2010 (12:40 pm)
I'm just a lowly programmer, so... is this possible in Milkshape?EDIT: THANKS! (How rude of me to forget to thank you. Awesome writeup.)
#6
06/03/2010 (12:53 pm)
Quote:I'm just a lowly programmer, so... is this possible in Milkshape?Hm. I'm not too familiar with MilkShape, but my understanding is that Milkshape provides the bare essentials for model creation... so I would be surprised if it offered vertex painting. But if it allows vertex painting and if it exports vertex color data into the Collada file format correctly, then it's possible. ;)
#7
06/03/2010 (1:01 pm)
Fair enough. Thanks! :)
#8
06/04/2010 (2:00 pm)
Thanks Russell, this will be a great help.
#9
I have tried various settings with $pref::windEffectRadius = 25; in the console however and nothing seems to make any difference.
I typed it into the console, is there nowhere in the World Editor where I can change this setting?
I tried up to 500 metres and still no change is evident, am i missing something?
I also noticed when I imported the default tree into max using opencollada that it has a huge bounding box around it which my willow tree does not, only the default max bounding box, and it also appears to have a large extra trunk, is this of any relevance?
06/06/2010 (12:46 am)
Thanks for the post Russel it's very informative.I have tried various settings with $pref::windEffectRadius = 25; in the console however and nothing seems to make any difference.
I typed it into the console, is there nowhere in the World Editor where I can change this setting?
I tried up to 500 metres and still no change is evident, am i missing something?
I also noticed when I imported the default tree into max using opencollada that it has a huge bounding box around it which my willow tree does not, only the default max bounding box, and it also appears to have a large extra trunk, is this of any relevance?
#10
I'm asking because I'd like to test around a little. I'm working on algorithms to procedurally generate coloring for our models - hoping to come up with a decent solution. If I had access to a working model, it would make things a lot easier. I dont have 3ds max, so that pipeline is sealed off from me at this time. Having a working tree model would be a great template for me.
I'd share this colorizer - in case I would have sufficient results - in this thread.
06/06/2010 (1:52 am)
@Russel: Does the defaulttree.dae model in the Torque 3D Full template have colored vertices? If it does not, would it be possible for you to give us a version of that model with colored vertices?I'm asking because I'd like to test around a little. I'm working on algorithms to procedurally generate coloring for our models - hoping to come up with a decent solution. If I had access to a working model, it would make things a lot easier. I dont have 3ds max, so that pipeline is sealed off from me at this time. Having a working tree model would be a great template for me.
I'd share this colorizer - in case I would have sufficient results - in this thread.
#11
->first;
the size of the trunk and the bounding box have no relevance to the vertex paint use on models for the forest kit.
- Are you;
1. placing a forest into the scene with the forest kit editor ?
2. are you using the default tree datablock included as the example ?
3. did you place a wind emitter nearby the forest ? Then raise it's settings to make the wind effect quickly noticeable ?
->second;
I would also like to know how to limit the effect distance of the emitters.
@Konrad;
the defaulttree model at LOD500 has painted verts.
//Edit; good docs Russell!
06/06/2010 (4:05 am)
Justin, I can't tell whether you're trying to use the emitter&forest but having issues or if you are trying to figure out how to limit the the wind emitter's area. So I'll go into both..->first;
the size of the trunk and the bounding box have no relevance to the vertex paint use on models for the forest kit.
- Are you;
1. placing a forest into the scene with the forest kit editor ?
2. are you using the default tree datablock included as the example ?
3. did you place a wind emitter nearby the forest ? Then raise it's settings to make the wind effect quickly noticeable ?
->second;
I would also like to know how to limit the effect distance of the emitters.
@Konrad;
the defaulttree model at LOD500 has painted verts.
//Edit; good docs Russell!
#12
06/06/2010 (4:15 am)
@eb: great! thanks for that info!
#13
06/06/2010 (8:33 am)
Was wondering if Forest Editor is included in the basic version of T3D. I can seem to figure out where it is. Probably for the $1000 version but I thought I would ask.
#14
I believe the Forest Editor (and Sketch Editor) are both in beta testing versions and will get a full release when there is a full release (1.1).
@ Russell
Thanks for the info - I can see what I was doing wrong previously. :)
edit: got it working with Blender :)
06/06/2010 (12:02 pm)
@DoniI believe the Forest Editor (and Sketch Editor) are both in beta testing versions and will get a full release when there is a full release (1.1).
@ Russell
Thanks for the info - I can see what I was doing wrong previously. :)
edit: got it working with Blender :)
#15
06/07/2010 (4:53 am)
Steve, can you post which collada exporter you're using with Blender(and which blender version) in case someone needs to know.
#16
Update on my procedural approach: Milkshape has not proven useful for creating such assets, but I've made some progress through directly acting on the vertices of the highest lod meshes of a collada object - even those exported from Milkshape.
So far my biggest issue has been grouping branches / leaves (green). It too much relies on perfect modeling. Nontheless, I hope I'll be able to show off some procedurally generated coloring soon.
Also, I wanted to ask you guys: Is there a simple way to visualize vertex colors on a Collada model? I've been coloring without actually seeing any colors - I was wondering if there was some simple app that lets me view Collada vertex colors. Thanks!
06/07/2010 (5:33 am)
Quick advice: Be sure to export your model with Z being the up axis. Y (default in Milkshape) seems to ruin the displacement animation for some reason. I'm still investigating why that happens.Update on my procedural approach: Milkshape has not proven useful for creating such assets, but I've made some progress through directly acting on the vertices of the highest lod meshes of a collada object - even those exported from Milkshape.
So far my biggest issue has been grouping branches / leaves (green). It too much relies on perfect modeling. Nontheless, I hope I'll be able to show off some procedurally generated coloring soon.
Also, I wanted to ask you guys: Is there a simple way to visualize vertex colors on a Collada model? I've been coloring without actually seeing any colors - I was wondering if there was some simple app that lets me view Collada vertex colors. Thanks!
#17
Blender Collada Exporter 1.4.1 (version 0.3.159)
And the general Collada setup:

And more indepth info on exporting Collada from Blender is available courtesy of Gary Hoffman and can be found here
Protip: Blender starts vertex painting as white (that's full 1 1 1 RGB maxed out - so every vertex is affected by default) so you need to paint it all black first or the whole thing starts moving like a solid gold dancer. ;)
06/07/2010 (5:37 am)
@eb - good idea, didn't think of that.Blender Collada Exporter 1.4.1 (version 0.3.159)
And the general Collada setup:

And more indepth info on exporting Collada from Blender is available courtesy of Gary Hoffman and can be found here
Protip: Blender starts vertex painting as white (that's full 1 1 1 RGB maxed out - so every vertex is affected by default) so you need to paint it all black first or the whole thing starts moving like a solid gold dancer. ;)
#18
http://www.youtube.com/watch?v=69ceaeIRJ9s
// Thx Steve, I'm sure loads of people will appreciate that.
06/07/2010 (6:35 am)
Konrad, I'd import your model to blender, paint and then export;http://www.youtube.com/watch?v=69ceaeIRJ9s
// Thx Steve, I'm sure loads of people will appreciate that.
#19
It takes too much time manually. Also, it doesn't seem to display the colors on dae files that work fine in the engine.
The procedural method is way too exciting! If nothing more, it creates a pretty good base canvas to paint onto.
06/07/2010 (6:45 am)
@eb: Thanks! I actually downloaded Blender again about an hour ago and gave it a try. It wasn't as scary as the last time. Though it's still unlike anything made on this planet.It takes too much time manually. Also, it doesn't seem to display the colors on dae files that work fine in the engine.
The procedural method is way too exciting! If nothing more, it creates a pretty good base canvas to paint onto.
#20
06/07/2010 (6:52 am)
if you can sort out some automatic methods..you would be my hero. ;D
Torque 3D Owner Greg G
ESALPllc