IN THIS ARTICLE
Creating Weight-Based Random Selection
When you create distribution using random selection, the vegetation asset that is selected for a particular point on the grid varies. The assigned weight of each asset determines its chance of selection. In this procedure, you specify weights and link to the gradient using the Vegetation Asset Weight Selector component.
The vegetation entity, or the entity that contains the Vegetation Layer Spawner component, must contain a component that assigns values for selection of the listed assets. This procedure uses the Vegetation Asset Weight Selector component for that purpose. It’s also helpful, though unnecessary, to add multiple assets if you haven’t already. If you have only one asset listed, your one asset and bare ground are used when you link the gradient in Creating a Gradient Entity .
To prepare the vegetation entity
Ensure that you have three or more vegetation assets on your entity that has the Vegetation Layer Spawner.
To add more vegetation assets, do the following:
In the Vegetation Asset List component’s properties, next to Embedded Assets, click +.Note:When specifying your first asset, you don’t need to click + because there is an empty asset displayed by default. Specify the mesh.
Under the blank asset, listed as
, next to Mesh Asset, click Browse (…).
In the search bar, enter a search term, such as flower, and select a vegetation asset.
Repeat this step with different assets until you have three or more assets.
Although you have specified multiple assets, only the first asset that you added appears in the Viewport. The next several procedures show you how to distribute the vegetation so that all of them appear.
Click Add Component, Vegetation Asset Weight Selector.
In the next step, Creating a Gradient Entity , you link this component to the gradient, which supplies values between 0.0 to 1.0 at a given position. Assets are then mapped based on those values and each asset’s weight and order values.
The gradient entity provides the noise signal to reference from the vegetation entity.
To create a gradient entity
Create a child entity under your vegetation area entity and select it.
Rename your new entity to a descriptive name, such as Gradient.
Add the component Perlin Noise Gradient.
This component generates a type of noise called Perlin noise, which mimics the type of randomness found in nature.Note:If you don’t have the Gradient category in your list of components, you must enable the Gradient gem.
Add the required Gradient Transform Modifier component.
This component controls how the procedural noise is generated in the world space.
Click Add Required Component and select Vegetation Reference Shape.
In the Vegetation Reference Shape component’s properties, next to Shape Entity Id, click the target button.
In the Entity Outliner, select the TestBox entity (or the entity that contains your shape if you named it something else).
The Shape Entity Id field populates with the entity name that you selected and uses the shape on that entity as its reference shape.
Before the gradient that you created can have any effect on the vegetation, you must reference the gradient from within the vegetation area. This means the component that you reference the gradient (in this example, the Vegetation Asset Weight Selector) in uses the gradient’s information for its selection of values.
You can reference the gradient that you created in any number of components. In the procedure Adding Scale, Rotation, and Position Modifiers , you use the same gradient for the vegetation modifiers.
To link the gradient entity to the vegetation entity
Select the entity BasicCoverage.
On the Vegetation Asset Weight Selector component’s properties, next to Gradient Entity Id, click the target.
In the Entity Outliner, select the Gradient entity.
The Gradient Entity Id field populates with the entity name.
Your vegetation area should now have variation in its vegetation selection.
Copyright © 2022 Open 3D Engine Contributors
Documentation Distributed under CC BY 4.0.
The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our Trademark Policy page.