The Scattering Tool
Creating a Rule
To create a rule, follow these steps:
- Create a prefab and assign it the Scattering Rule Script.
Important: do not confuse the Scattering Rule Script with Scattering Rules.
- Set the Rule Type to either Tree (better for trees and large rocks) or Details(better for grass and small objects).
Note: Details do not support have LODs.
- Adjust the size of the prefab.
- Specify the Minimum Distance Between Instances during painting. To visualize the distance, go the Prefab view.
- To visualize the scattering, In Prefab view, activate Edit Rule 1.
Adding rules with prefabs that spawn at the same time
You can add Rules that contain prefabs which spawn alongside the prefab you selected. You can set:
- The inner and outer radius.
- The minimum and maximum number of prefabs to be generated.
You can visualize these rules when Edit Rule 1 is selected in the Prefab view.
Painting Rules
The Scattering Tool lets you create complex foliage with little effort.
Add Rule Prefabs
- Select Paint Rules in the terrain tab in the inspector.
- Use the +/- buttons to add the rule prefabs that contain the Scattering Rule script.
Adjust Brush size and Tree Density
To adjust Brush Size and Tree Density, do any of the following:
- To paint, click/select rules.
- To erase rules, press CTRL + click/select.
- To erase only rules of a selected type, hold SHIFT.
- To paint multiple trees and details at the same time, select all rules.
Exclusion Zones
You can automatically exclude certain rules from the terrain. Exclusion Zones let you selectively remove prefabs in areas that you designate.
To createa an Exclusion Zone, follow these steps:
- Add the geometry that defines the exclusion zone.
- Place it as a group under a GameObject.
- Add the Mesh Exclusion Zone Impl script to the parent GameObject.
Note: If you don’t have a parent GameObject, you don’t need to add the Mesh Exclusion Zone Impl script.
- Change the resolution. A higher resolution improves the accuracy when the system removes rules in line with the mesh.
- Add the rules you want to exclude from the zones. If the rules contain other prefabs, you can delete them by selecting Include Sub Rules.
- Add the Exclusion Proxy script to the meshes.
- In the Terrain inspector tab, under Paint Rules, select Update Exclusions.
Terrain Splatting
Rules and GameObjects support painting in the terrain splat maps. This is useful when you want to change the ground texture based on what is on the terrain.
For example, you can have the system automatically paint dirt under a tree instead of grass.
To set up Terrain Splatting, follow these steps:
- Create an Alpha Splat Definition scriptable object. This object defines the splatmat you want to paint and the intensity.
- Assign the name of the layer you want to paint and specify the contribution for it (for example, !).
- Assign a Splatmap Painter component to the object you want to paint to the splat maps and then assign the Alpha Splat Definition scriptable object.
- To update the splatmat, return to the Terrain Paint Rules tool and select Update Splatmaps.
The tree splattered in the splatmat looks like this:
Splatmap Proxy
Splatting takes the shape of the object from a top down view. To make the splatting bigger or a different shape, you can use Proxy Meshes:
- Create a new child object from the tree.
- Assign a Splatmap Proxy component to the new child object.
The system uses the proxy to paint in the splatmat instead of the original mesh.