Game Development Community

Forest Kit Animated trees with wind force?

by Jim Kaiser · in Torque 3D Professional · 11/28/2009 (1:03 am) · 29 replies

Maybe I missed something, but aren't you suposed to have the wind force effect the sway of the trees?
I just can't figure out how to do this...can someone explain?

Maybe I just can't see the tree because of the forest?
Page «Previous 1 2
#1
11/28/2009 (2:02 am)
The object responsible for this is the ForestWindEmitter. It was not exposed to the World Editor's Creator for the 1.1 Alpha, but it is still in the engine. You just need to manually copy it into your .mis file:

new ForestWindEmitter() {
      position = "395.693 889.352 10089";
      rotation = "1 0 0 0";
      scale = "1 1 1";
      isRenderEnabled = "true";
      canSaveDynamicFields = "1";
      windEnabled = "1";
      radialEmitter = "0";
      strength = "1";
      radius = "0";
      gustStrength = "0.25";
      gustFrequency = "3";
      gustYawAngle = "10";
      gustYawFrequency = "4";
      gustWobbleStrength = "2";
      turbulenceStrength = "0.25";
      turbulenceFrequency = "2";
      hasMount = "0";
   };

Add that to your mission file, then save it. When you load your level, your forest will now be affected by wind. You can even edit the ForestWindEmitter object's properties from the World Editor. This will be exposed in the next 1.1 update.
#2
11/28/2009 (2:59 am)
Actually it is in the 1.1 alpha... if your not getting it then download the installer again. There was a screw up and the wrong installer was up for the first 48 hours.
#3
11/28/2009 (3:10 am)
OK...Thanks!
#4
11/28/2009 (5:58 am)
How do you setup a tree to respond to the wind emitter ?
#5
11/28/2009 (11:56 am)
Its pretty straight forward, drop a wind emitter, and the tree's start moving.
#6
11/28/2009 (3:29 pm)
The default tree does respond. My models do not.
#7
11/28/2009 (3:53 pm)
Akiraa, I am sure it has something to do with vertex paint. Let me download the new installer and have a test this afternoon.
#8
11/28/2009 (4:11 pm)
thank you for the hint.
#9
11/28/2009 (4:20 pm)
What about breakable? What do the trees need in order to be broken?
#10
11/28/2009 (4:39 pm)
open up the collada default tree, you will see there are bounding meshes around the leaves and another around the trunk. they are green and pink i recall, brightly colored. setup your tree like that and it should sway. haven't test yet but that looks like that is the way to get it working. as far as breakable, i would be interested in how to do that also.
#11
11/28/2009 (7:04 pm)
Trees are not breakable, please disregard that field, sorry.
#12
11/28/2009 (7:15 pm)
The trees appear to only bend within 20' of my camera. I havent found the right setting to change, yet. Anyone care to throw me a bone ? thx
#13
11/28/2009 (11:19 pm)
@Guy - I think thats currently hard coded in the 1.1 alpha. I'll set that up as a $pref:: so that it can be tweaked easier.

As far as how to make a new tree work with the wind effects i believe we have a doc in the works on that. The basics is your painting in weights into the RGB vertex colors of the tree to define the per-vertex amount of each wind effect.
#14
11/29/2009 (8:12 am)
Sorry for sounding dumb, but ive not come across vertex weight painting stuffs...

is this similar to how 3ds max uses soft selection but for real time effects?
#15
11/29/2009 (11:24 am)
In short, this is how you would distribute vertex painting to a tree so it is properly affected by the wind:

  1. 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.
  2. 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).
  3. 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 I can just fill the entire frond with blue.
  4. Vertical bend: the vertical bend of a tree does not have to be painted... that is calculated automatically by its height
How you actually apply these color sets varies between modeling apps, but here's how I do it in Max:

  1. Stack three separate Vertex Paint modifiers on the tree model.
  2. 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.
  3. After all three have been painted their own color set, set the blend mode of the top two Vertex Paint modifiers to "additive".
  4. 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.
I use the free OpenCollada as my exporter. The last I checked, Max's built-in 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.

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%.
#16
12/01/2009 (4:32 pm)
Interesting. Thanks for the write up... will be very helpful!

Russel,
I have been using the Blender DTS exporter lately, but am having a hard time thinking up the best solution to export the 3 vertex channels you are using. How hard do you see a modification to the source to be to use some specifically named vertex groups to do the same thing as vertex colors? Meaning, in blender I set up 3 vertex groups (similar to weight groups set up per bone) ie, 'branches', 'branch_groups', 'leaves', paint and export these with the tree dts.

Not having access to the source right here, I figure I would ask the question to see if you might have a suggestion/caveat and let others pipe in before I tackle this.

I havent tried the Blender collada export to see if it exports vertex coloring properly. I know the collada export(1.4) of blender has had some issues, hopefully addressed in the 2.5 release as the collada integration is supposed to be much better. This may be what I need to wait for eventually anyways.

Thanks you guys for the amazing work, very much appreciated and would have been worth the $ if you had decided to sell it as an add-on. I do think you made the right choice, for the sake of the engine. I'm off to buy Torsion at least to contribute back what I can.
#17
12/01/2009 (6:18 pm)
Man, I really didn't mean to sidetrack this thread with talk about vertex painting, but I guess since the original question was answered, this isn't a bad place to have this discussion.
Quote:I have been using the Blender DTS exporter lately, but am having a hard time thinking up the best solution to export the 3 vertex channels you are using. How hard do you see a modification to the source to be to use some specifically named vertex groups to do the same thing as vertex colors? Meaning, in blender I set up 3 vertex groups (similar to weight groups set up per bone) ie, 'branches', 'branch_groups', 'leaves', paint and export these with the tree dts.
I'm not really familiar with vertex groups, so unfortunately I can't really comment on using them for this purpose. As far as using dts at all, Collada is really the way to go for vegetation, if you have a good exporter. I can't really see any way to achieve getting this extra information into dts.

If you end up having trouble with Collada files exported from Blender working as expected in T3D, make sure to let Torque Powered know. Chris Robertson has been doing an excellent job with the Collada importer and can probably address the issue. He's been continually working on it, so if you haven't tried a Blender-created Collada in the 1.1 alpha yet, you might want to give it a try.
#18
12/11/2009 (6:47 pm)
Is there a way you can just use the 'ambient' animation like in the replicator?
#19
12/11/2009 (7:04 pm)
Well, technically you could rig and create animations for any mesh and have it play an ambient animation. So this would be fine if used in just a few trees. But the amount of bones animating in a populated forest would be prohibitively expensive.
#20
12/13/2009 (11:51 am)
hello:)

Sounds not easy to me... Is there any hope to get a nice large plant kit in near future? Or maybe a plant editor ? This would help noobs like me to get, or make nice plants for the forest editor.
Page «Previous 1 2