Static mesh tree in UDK examples. How are they achieving the wind movement?

The example tree I’m referring to is FoliageDemo.Speedtrees.ShaneTree_01 (although there are several that do the same thing).

They are using two separate materials which use WindDirectionAndSpeed nodes to simulate the movement.

However I’m unsure how they are making the top of the tree sway more than the bottom, and also how are they syncing the material for the leaves with the bark (so that they appear attached to the branches).

Another odd thing is I seem unable to replace the materials on the tree, they seem somehow baked into the mesh.

The reason I ask is I’d like to use a similar approach to create long pieces of seaweed that slowly move underwater.

Does anyone have any light they could shed on this?

The Material you are looking for is FoliageDemo.Speedtrees.M_SpeedTreeMaster_02Wind, look at what is attached to WorldPositionOffset. Copy that section and attach it to your materials WorldPositionOffset.

I do a similar effect with some of my materials. The thing you can’t see, which makes the tips bend more than the base, is the vertex color. I paint the vertices black at the base of the plant, and white at the tips. Then I multiply the movement amount by the red channel of the vertex color. That’s also how I tell the game how far to move the fabric on materials like this:

for trees you don’t need any vertex color if you want a simple wind. in the material you simply take the local worldposition in Z and divide it by the height of the mesh, which results in a black-white vertical gradient along the height of the tree. multiply that gradient with your wind and you have no wind at the base transitioning to full wind at the very top

@Nathaniel3W that looks nice, but would be even nicer if you would recompute the normals. atm the wind affects the position but the shading isn’t affected :wink: