Overview

This tutorial shows you how to create a basic setup for vegetation categories and vegetation objects, and how to place and modify them in a level.

The best results are achieved by manually placing the vegetation objects, as it gives you the most control. However, by setting up interesting vegetation categories, you can create a good looking base that needs only minimal reworking.

To create nice looking presets, you can tweak the values that will be discussed towards the end of this tutorial.

For information on creation and tuning of AutoMerged vegetation objects, see Bending Setup and also the Vegetation Parameters below.

Vegetation Toolbar

By default, not all of these icons are visible as the RollupBar is too thin to fit them all.

All of these options are available in the Right-Click context menu and inside the Vegetation DB Tab.

  1. Add Vegetation Object
  2. Clone Vegetation Object
  3. Replace Vegetation Object
  4. Add Vegetation Category
  5. Remove Vegetation Object
  6. Export Vegetation
  7. Import Vegetation
  8. Distribute Vegetation on Whole Vegetation
  9. Clear Vegetation
  10. Scale Vegetation
  11. Merge Vegetation
  12. Put Selection to Category

Vegetation Setup

On the RollupBar, click Vegetation to select the Vegetation tool:

Adding a Vegetation Category

Click the Add Vegetation Category button:

Enter a name for the new category:

Confirm the name by clicking OK or by pressing Enter. This creates a new category called "Forest" that will be available in the objects list.

Click Forest to select it:

The square to the left of the name toggles the visibility state of the category. It also controls whether the object/category will be exported to engine. This allows you to experiment with vegetation setups in Editor and only export to pure-game what you want.

At the moment, no objects have been added and therefore, it is not active. By clicking the grey triangle, you can show and hide the vegetation objects stored inside the category.

Adding Vegetation Objects

Make sure the new "Forest" category is selected. Click the Add Vegetation Object button.

A file dialog will be displayed where you can select the object to add.

The file dialog gives you a lot of information about the object that you are about to place into the level including file size, the number of faces and verts, as well as the number of LOD's and materials used by the object.

Navigate to the folder: <GameFolder>\Objects\natural\trees\jungle_tree_large\

Select the jungle_tree_large.cgf file. Click Open or double-click the file.

The vegetation object will now appear in the list, inside the Forest category.

Placing Vegetation Objects

Select jungle_tree_large in the Objects list.

The text will be highlighted to indicate that the object has been selected and can be painted or manually placed.

Manually Placing Single Objects

You can manually place selected objects by holding down Shift while the vegetation object is selected in the Vegetation Tool and then clicking the mouse button in the Perspective viewport. The selected object will be placed on the terrain, based on the position of the mouse pointer.

In the image below, the tree has been selected, which is indicated by the green and blue ring around the tree. If "Highlight Selected Vegetation" is enabled in the Sandbox Preferences, you will also see that.

Hold down Alt, click the mouse button, and move the mouse pointer to scale a selected vegetation object.

Moving the mouse pointer up/down while holding down Ctrl+Alt and clicking, rotates the vegetation object.

Keep an eye on the status bar, as quite often helpful information is shared about the currently active tools.

Painting with the Paint Objects Tool

Now click Paint Objects and increase the Brush Radius by clicking and moving the slider to the right. You can also specify more exact dimensions in the input field above it.

If you move the mouse pointer into the Perspective viewport, you will see the brush, indicated by a green circle. Click and move the mouse pointer around to paint some vegetation. You will see the trees being distributed on the landscape.

The distribution will be very regular. However, you can adjust the options within the vegetation tool panel to give the vegetation brush some variety (size, sizevar, random rotation and bending used here):

By holding down Ctrl and clicking, you can erase the vegetation objects. You should see the remove text appear in the middle of the brush. Try it on the trees that you just painted.

Before RemovalAfter Removal

Moving Vegetation Objects

As of CRYENGINE 3.5.3, there have been some tweaks to the way moving vegetation objects are handled. A problem which became more evident when dealing with very dense vegetation (auto-merge grass) was that moving vegetation to an invalid location resulted in seemingly sporadic behavior of the Editor.

If you've ever noticed vegetation jumping back and forth as you move it around, this is because the vegetation system was unable to find a valid location to place the moved instance (too dense, not enough room). When this happens, the vegetation instance is moved back to its last-known-good location. How we've improved this behavior is the important part though. The process is outlined as follows...

Select a chunk of vegetation:

Moving to an empty area is no problem:

Now, try and fit this dense chunk of grass on top of another dense chunk of grass.

The vegetation that fails to find a valid location will still return to its last-known-good location but now it will be highlighted red:

Pressing ESC will then de-select the successfully placed vegetation and keep the failed vegetation selected.

This allows you to either delete it or proceed to move it again:

This readability on exactly what the vegetation system is doing should make it much easier to control placing vegetation assets, as well as ensuring no wasted resources and over-packing of assets.

Vegetation Parameters

Below you'll find a list of available parameters for vegetation objects. Keep in mind that you can adjust properties for multiple objects or entire groups at the same time by selecting multiple objects, or selecting the group (such as "Forest" as we created earlier).

Parameter

Description

Notes

Size

Changes the size of newly placed vegetation objects. This allows you to uniformly scale the vegetation, where 1 represents 100%, and therefore, 1.5 is 150%.

Only applies to newly placed objects.

SizeVar

Changes the size variation +/- of newly placed vegetation objects. This is the size variation within a set of painted vegetation objects of one kind. This works on a per brush stroke basis. Keep Size at 1 and set SizeVar to 0.2 to get a nice variation. Be careful using this value too excessively as it can make it difficult to optimize view distance ratios, given that there's only one MaxViewDist setting but the objects vary in size and can be more noticeable when larger objects disappear.

Only applies to newly placed objects.

RandomRotation

Randomly rotates objects while painting new vegetation objects. To create a more natural look and distribution, you can set up a RandomRotation in the vegetation objects when you paint them. This feature works only if you use the Paint Object tool.

Only applies to newly placed objects.

AlignToTerrainCoefficient

0 - 1 Setting this to 0 makes the object ignore the the terrain "angle" at the point where its placed. Setting it to 1, means the vegetation will align itself perpendicular to the terrain angle. Setting this to 0.5 or any number in-between 0 - 1, allows the vegetation object to align 1/2 way between vertical (0) or full terrain alignment (1). This offers more control than before where it was previously a checkbox.

 

UseTerrainColor

Makes the individual object receive the color of the underlying terrain so that it matches better. This option is used to blend the grass with the underlying terrain color. You can also use this option on other objects, but it works best with grass. This effect is especially useful for disguising grass that fades in the distance.

 

AllowIndoor

Enables the vegetation to be rendered within vis areas.

 

Bending

The Bending value controls the procedural bending deformation of the vegetation objects. It ranges from 0 to 100, 0 meaning no bending effect and 100 meaning the maximum effect. This works based off the amount of environment wind (WindVector) in the level.

Ignored by AutoMerged settings.

Hideable

Deprecated - Can be set to hideable so that AI used it as hard cover, or to secondary so that AI used it as soft cover.

 

PlayerHideable

Deprecated - Player can use object for cover.

 

GrowOnVoxels

Deprecated - Make the objects placeable on voxels.

 

GrowOnBrushes

Control the placement of objects on brushes.

Only applies to newly placed objects.

GrowOnTerrain

Control the placement of objects on terrain. Useful if you want them placed only on Brushes.

Only applies to newly placed objects.

AutoMerged

Enable AutoMerged system on this object. see Bending Setup for more information.

Requires specific asset setup.

Stiffness

Controls the stiffness, how much it reacts to physics interaction, for AutoMerged vegetation.

Requires AutoMerged active.

Damping

Physics damping for AutoMerged vegetation.

Requires AutoMerged active.

Variance

 Requires AutoMerged active.

AirResistance

Similar to 'Bending' setting but specifically for AutoMerged vegetation.

Requires AutoMerged active.

Pickable

Allows the player to pickup the object.

 

AIRadius

Deprecated - Used to tell the AI how wide the object is.

 

Brightness

Deprecated - Changes the brightness of the vegetation group.

 

Density

Adjusts the density, e.g. how close individual objects are near each other while painting new vegetation objects. The density setting ranges from 0 to 100. This value represents the distance between each vegetation object. Set the value to 10 and paint some trees. Trees will be placed further apart from each other. If your density setting is bigger than your brush radius, the vegetation will not be painted, so always make sure you have a suitable brush radius when painting.

Only applies to newly placed objects.

ElevationMin

Limits the minimum height at which you can paint vegetation objects.

For painting underwater vegetation, make sure to adjust the ElevationMin value. Set it lower than the ocean; 0 is a safe option.

Only applies to newly placed objects.

ElevationMax

Limits the maximum height at which you can paint vegetation objects.

Only applies to newly placed objects.

SlopeMin

Limits the minimum angle of the terrain on which you can paint vegetation objects. 255 equals 90 deg. With a higher than 0 slope value specified you can no longer place objects at flat grounds.

Only applies to newly placed objects.

SlopeMax

Limits the maximum angle of the terrain on which you can paint vegetation objects. 255 equals 90 deg. With a lower than 255 slope max value specified you can no longer place objects on very step areas.

Only applies to newly placed objects.

CastShadow

Makes the object cast a shadow based on the minimum selected config spec. "High" won't work on Low/Medium specs, for example.

 

RecvShadow

Deprecated - Turns on/off the effect that objects can receive shadows.

 

AlphaBlend

Deprecated - Turns on alpha blending for textures with alpha channel.

 

SpriteDistRatio

Deprecated - Adjusts the distance when the sprite rendering should be enabled.

 

LodDistRatio

Adjust the distance when the LOD changes.

 

MaxViewDistRatio

Adjusts the maximum view distance per vegetation object.

 

Material

Specifies a custom material to apply to the vegetation object.

 

UseSprites

Deprecated - Turns on / off the use of sprite rendering in the distance.

 

MinSpec

Makes the group only be rendered at the specified system spec.

 

Layer_Frozen

Deprecated - Turns on the frozen layer material settings

 

Layer_Wet

Deprecated - Turns on the wet layer material settings

 

Use_OnTerrain_Layers

Sets up the vegetation group to be procedurally distributed across the level on selected surface types with the specified density, slope and altitude parameters.

 

Results

To conclude:

You should see a result that looks something like the following screenshot. Move the camera into the jungle, slightly over the ground to get a real feeling of the jungle that you have created.

You don't need to add many vegetation objects to create a lot of variation. Use the brush to paint an area without trees, just by selecting the bush and grass object.

 

With the Vegetation tool, you can manually or automatically fill the levels with vegetation, after setting specific parameters.