docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    The Scattering Tool

    • Creating a Rule
    • Painting Rules
    • Exclusion Zones
    • Terrain Splatting

    Creating a Rule

    To create a rule, follow these steps:

    1. Create a prefab and assign it the Scattering Rule Script.
      Important: do not confuse the Scattering Rule Script with Scattering Rules.

      alt_text
    2. 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.
      alt_text
    3. Adjust the size of the prefab.
      alt_text
    4. Specify the Minimum Distance Between Instances during painting. To visualize the distance, go the Prefab view.
      alt_text
    5. To visualize the scattering, In Prefab view, activate Edit Rule 1.
      alt_text

      alt_text

    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.

    alt_text

    alt_text

    Painting Rules

    The Scattering Tool lets you create complex foliage with little effort.

    Add Rule Prefabs

    1. Select Paint Rules in the terrain tab in the inspector.
      alt_text
    2. Use the +/- buttons to add the rule prefabs that contain the Scattering Rule script.
      alt_text

    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.

    alt_text alt_text alt_text alt_text alt_text alt_text

    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:

    1. Add the geometry that defines the exclusion zone.
    2. Place it as a group under a GameObject.
      alt_text
      alt_text
    3. 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.

      alt_text
    4. Change the resolution. A higher resolution improves the accuracy when the system removes rules in line with the mesh.
    5. 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.
      alt_text
    6. Add the Exclusion Proxy script to the meshes.
      alt_text
    7. In the Terrain inspector tab, under Paint Rules, select Update Exclusions.
      alt_text

    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:

    1. Create an Alpha Splat Definition scriptable object. This object defines the splatmat you want to paint and the intensity.
      alt_text
    2. Assign the name of the layer you want to paint and specify the contribution for it (for example, !).
      alt_text
    3. 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.
      alt_text
    4. To update the splatmat, return to the Terrain Paint Rules tool and select Update Splatmaps.
      alt_text

    The tree splattered in the splatmat looks like this:

    alt_text

    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:

    1. Create a new child object from the tree.
    2. 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.

    alt_text

    alt_text

    alt_text

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)