Tutorials UE3 Foliage/Deco
About : How to set up foliage and decolayers on terrains.
Target Audience : UT3 – Intermediates
Platform : Unreal Engine 3
Last Update : January 2008 – Foliage was removed from the engine from the October or November 2010 build and onwards!
Foliage and Deco Layers on terrains are used to randomly scatter staticmeshes around, a feature most commonly used to quickly populate an environment with trees and grass, or with rock boulders.
Foliage Layers: Used for anything small like grass and small plants. Foliage meshes do not have collision, and are not lit well. They are scattered around completely random. Also, they fade out after a certain range and they can respond to the wind actor. Foliage Layers are very similar to the Deco Layers in UE2.
Deco Layers: Used for larger objects, such as rocks and trees. Deco Layers have collision and receive lighting, but they are scattered around using a grid, making the result less random. They never fade out, and they can’t respond to the wind actor.
Staticmeshes can also be scattered around using a Foliage Volume. This is especially handy for smaller areas, or when no terrain is available. Please refer to my Foliage Volume tutorial for information on that.
Foliage Layers are embedded into regular Terrain Material layers, and are thus linked to the material. Paint another material over the one that contains the Foliage Layer, and the Foliage Layer too will disappear. So unlike UE2, it is now very much dependent on the material it belongs to. If the material is invisible, so will the Foliage Layer.
In the Generic Browser, browse to the Terrain Material of the layer of choice, usually found within the MyLevel package of the level, and doubleclick it to get to its properties. Expand Foliage, and add an item to FoliageMeshes using the little plus button.
StaticMesh: What staticmesh it will use for the Foliage Layer. A grass mesh would do well.
Material: This property is optional. If you leave it empty it will use the material specified in the properties of the staticmesh. If you fill something, it will override it.
Density: How many times the staticmesh is instanced. A number like 3 would be a good start.
MaxDrawRadius: At what distance the foliage meshes should start disappearing, for perfomance reasons. A couple of thousand should do.
MinTransitionRadius: Until what distance the foliage meshes should be displayed full scale. The bigger the difference between MaxDrawRadius and MinTransitionRadius, the softer the fade out. Can be left at 0.
Min and MaxScale: The size of the foliage meshes.
Seed: Can be left at 0. Other numbers will randomize the placement of the foliage meshes differently.
SwayScale: In combination with the WindDirectionalSource actor (see Foliage Volume tutorial), this controls the amount of influence the wind has on the foliage meshes.
AlphaMapThreshold: A higher value will make it spawn less or no foliage meshes at all near the edges of the painted area.
SlopeRotationBlend: The rotation of the foliage meshes dependent on the angle of the terrain quad below.
If you did all of this correctly, the meshes should show up wherever the material is painted. In my test scenario, it got me a beautiful landscape of springs.
Deco Layers are set up in a similar fashion. Open up the properties of the terrain itself, simply doubleclicking its surface anywhere in the level should do, and navigate to Terrain – Decolayers. Add an item to it, and then add yet another item to Decorations. Then, add a StaticMeshComponentFactory to it, and correctly set the StaticMesh and other relevant properties.
Just like the Foliage Layers, you are not required to add materials to the Deco Layers. If you do not enter any material, it will use the one assigned to the staticmesh. The properties also give you access to some obvious properties such as CastShadow, Hidden, and several collision properties. The Min and MaxScale, Density, and SlopeRotationBlend are also very similar to the ones found in a Foliage Layers. As is the RandSeed (Seed).
Note that the Density should be set quite high, a number like 20 should do. Also, a name can be entered at the top of the Decolayers section if you desire so.
Once you’ve set that up, open the Terrain Edit window, and select the Deco Layer in the Layers list, and start painting it as if it were a regular Terrain Material.
It should show up wherever you paint it.