Creating a Vegetation Layer
Creating a vegetation layer is the most basic step in creating your dynamic vegetation, however a few requirements must be met in order to spawn vegetation successfully.
Prerequisites
To spawn vegetation assets using a Vegetation Layer Spawner component, you must have a surface to plant on. You can establish a surface by doing any of the following:
- Add a Mesh Surface Tag Emitter component to the Ground entity that exists as a part of the Atom Default Environment entity hierarchy that is included with each new level. (This technique is used in the example that follows.)
- Add a Mesh Surface Tag Emitter component to any other entity that has a Mesh component.
- Add a Shape Surface Tag Emitter component to an entity that has a Shape component.
- Add Terrain to the level.
You must also have vegetation assets that the Vegetation Layer Spawner can spawn. For the example that follows, we created a prefab named DryGrassLarge.prefab
using the following steps:
- Create a new entity.
- Add a Mesh component.
- Assign a vegetation
.fbx
file to the Mesh component. - Save the entity as a prefab.
Now that the basic requirements for spawning vegetation are met, we can create our vegetation layer.
To create a vegetation layer
Create an entity and name it.
In this example, the entity is named BasicCoverage.
Add the Vegetation Layer Spawner component to your entity.
The Vegetation Layer Spawner component is the core component that initializes the engine that spawns vegetation.
Click Add Required Component and choose Shape Reference.
The Shape Reference has no shape on its own. You must next create a child entity and add a Shape component, which you will reference in the Shape Reference.
Right-click BasicCoverage, select Create Entity, and name it TestBox.
Select TestBox, click Add Component, and select the Box Shape component.
Adjust the size and position of the shape so that it’s large enough for your purposes and intersects with the ground.
Select BasicCoverage and, in the Shape Reference component, click the entity picker icon and select the TestBox entity.
Click Add Required Component and choose Vegetation Asset List.
The Vegetation Asset List component defines what to plant. This is where you specify vegetation assets.
In the Vegetation Asset List component, change the Instance Spawner type to Prefab, and then next to Prefab Asset, click the folder icon to browse for your asset.
In the Pick a Prefab window, enter grass into the search bar to filter the list of available prefabs. Select the
DryGrassLarge.prefab
asset in the results.You should have a uniform grassy field with the grass in a grid formation.