Tree and Bush Setup

Overview

Trees and bushes are integral parts of the environments and have extended functionality, like detail bending affected by wind or touch bending affected by the player.

Additionally, trees can also have breakable trunks. For this purpose, bushes are considered trees without trunks. The following instructions apply to trees, but can be used for bushes as well; just exclude any trunk setup.

Sample Files

3ds Max Setup

Model Setup

Normally, an average tree consists of 4 elements:

  • Trunk - Usually no alpha textures, provides the pivot, elements are linked to the trunk for export if no additional helper is used.
  • Leaves - Usually another material ID for textures using alpha (eg. leaves, small branches), planar objects can be used for touch bending.
  • Bending Proxy - Proxy is necessary for activating touch bending (touch bending area), separates several breaking areas for multiple breakable branches.
  • Obstruct Proxy - Provides soft cover area for AI and player, affects the weight balance point and the physical behavior if the tree is breakable.

Optional:

  • LOD's - Can be included to decrease rendering time in the distance.
  • Dummy - Alternative root object, all objects (except LOD's) including trunk can be linked to the dummy.

Sample tree:

Sample tree hierarchy, with the dummy as the root for export:

Important

The proxies must be attached to the main render mesh. It's not possible to link them as for brushes.

Touch Bending

When a player should be able to move and interact with the leaves/ foliage by pushing it with his body, the leaves need to be set up for Touch Bending.

The other type of bending, DetailBending, is used for wind-based bending effects.

Material Setup

An average tree has a Multi/Sub-Object material, with at least 4 different Material IDs:

  • Leaves - Foliage and branches (alpha textures).
  • Trunk - (non alpha textures).
  • Bending proxy
  • Obstruct proxy - AI cover.

The lower the number of rendered materials, the better the performance. The naming is irrelevant.

To have the physics settings work correctly, the Crytek shader must be applied on all the materials.

  • "Default" for the trunk, "physicalized" will enable the collision in the engine, procedural breaking with the corresponding surface type (don't use it for non breakable trees)
  • "noCollide" for the bending proxy. This defines the area where touchbending is possible. Touch bending gets enabled by physicalized objects within this area.
  • "obstruct" for the AI proxy. This Area the AI can not see through, but you and the AI can walk through.
  • The material for leaves/foliage and (2D) branches do not need physics.

Example for physics selection:

Export Setup

Export only the root of the object. Everything linked to the root will be automatically exported into one .cgf file. Pay attention to the settings in the Geometry Export Options in the picture below.

Example for export settings:

Example for link structure, with the trunk as the root:

Setup in Maya

Modeling

Depending on what type of tree you are creating; your process my vary but for this example we will start out with a tree stump.

This will now become the frame from which you will add the branches to.

Hierarchical Setup

  1. Create a group under the 'cryexportnode' named '@_helper' replacing the '@' with the name of your model.
  2. Create a material for the trunks which uses 'default' physicalisation to physicalise the render geometry.
  3. Create a material for the leaves which has 'none' set for its physicalisation option.
  4. Assign the relevant materials to the trunks and leaves.
  5. To create a bendable branch you must place locators that are snapped to vertices along the leaf. The locators must use the naming convention branch%_$ - where % corresponds to the branch id and $ is the joint id on that branch eg. branch1_1, branch1_2 and branch1_3.

  1. To enable the branches to become usable in game you must add a 'bending_proxy' volume that encompasses the extents of the leaves that will be bendable. eg. create a sphere and ensure the branches are on the inside of the sphere.
  2. Create a new material for the bending proxy with 'NoCollide' set as its physicalisation.
  3. Apply the bending proxy material to the bending_proxy geometry.

  1. Select the 'cryexportnode' group.
  2. Select the file type from the drop down that appears in the 'Node Options' section.
  3. Ensure the 'Do Not Merge Nodes' option in the 'Node Options' section is checked.
  4. Click the 'Export' button on the 'Crytek Export' dialog.
  5. The hierarchy with LOD's and proxies and branches should look like the above.

You have to place your breakable foliage as a vegetation object placed onto the terrain in order to work in Sandbox. Also, your sys_spec level settings must allow the tree to LOD down to LOD0 to allow breaking.

Material Setup

An average tree has a Multi/Sub-Object material, with at least 4 different Material IDs:

  • One for the leaves/foliage and branches.
  • One for the trunk.
  • One for the bending proxy.
  • One for the AI cover.

Setup in Sandbox

Be sure that your leaves material is a vegetation shader. This will allow for detail bending and other features to make your tree look and act more realistically.

Breakable Trunk Setup

For information on creating breakable vegetation assets, please see Boolean Destructibles.

Placing Trees in Sandbox

See the Vegetation Creation article for more information.

Debugging

These are the console commands that you can use to debug the asset in the Editor:

  • p_draw_helpers 1 - Shows all the proxies of your meshes (including obstruct, bending proxies)
  • p_draw_helpers 2 - Shows the physics proxies of your meshes, show the touch bending bones if you enter the bending proxy (F1 = 3rd person is helpful)
  • e_debug_draw 1 - Shows the actual LOD's, texture and mesh memory

If you type in 0 instead of 1, you can turn them off.