Nature Shaders is a collection of shaders intended for vegetation in Unity. You can use Nature Shaders to improve the quality of your vegetation rendering, and to enable effects such as interaction or wind simulations.
Step 1: Import Nature Shaders
Importing Nature Shaders is very straightforward: just import the Unity Package that you downloaded from the official website, or import Nature Shaders from Unity's package manager.
There is no need to worry about the render pipeline that you are using, Nature Shaders automatically imports the correct assets.
After importing Nature Shaders for the first time the demo scene will automatically open. Select any of the "Move Me" objects in the scene and move them around to see the interaction and overlays in action.
Step 2: Create a Nature Asset
Now that you have Nature Shaders in your project you probably want to use it for some of your own models. Nature Assets are used to easily set up or convert models and prefabs for use with Nature Shaders.
- Right-click on a model or prefab and select Create > Nature Asset.
- Select the new Nature Asset to show the import settings in the inspector.
- Find the Material Conversion section in the import settings and assign the material types for each material. The material type determines what shader is used for the material, and also determines how the mesh is analyzed. More details can be found in the Nature Assets article.
- Click "Apply" at the bottom of the inspector to apply the settings, and then drag the Nature Asset into the scene to use it.
- Adjust additional settings to tweak the model. See the Nature Assets article for all the settings that can be edited.
Do not delete the original assets after creating a Nature Asset. The Nature Asset is linked to the original assets and is updated when you modify the original assets.
Alternatively, you can manually set up a new material.
Step 3: Enable wind in your scene
Wind is enabled by default for new materials, but still needs to be set up in the scene.
Create a new game object in the scene and add a "Global Wind" component. The Global Wind component controls the wind settings for the scene. In the component you can adjust the wind strength, direction, and more.
For a quick and easy setup you can select a preset from the Load Preset dropdown.
See the Wind article for a full description of each setting.
Step 4: Enable interaction and overlays
The materials are automatically set up for interaction and all other features but you still need to set up the objects in your scene.
Interaction
- Select the game object in the scene that you want the vegetation to interact with.
- Add a collider to the game object if it does not have any colliders. The colliders are used for interaction.
Tip: Set up a Collision Layer if you want the collider to only interact with vegetation and not with other objects. - Add a Nature Collider component. This component will register the colliders on the object as colliders that should interact with vegetation.
- That's it, the vegetation should now interact with the object and sway when the object moves around. Both in edit-mode and at runtime.
Read more in the article about Object Interaction.
Overlay
- Select a game object in the scene that you want to use as overlay, or create a new game object.
- Add a collider to the game object. Vegetation within this collider will be affected by the overlay.
Tip: Set up a new collision layer for overlay objects, so that the overlay colliders don't interact with other objects in the scene. - Add a "Nature Overlay" component to the game object. This will register the collider as being an overlay, and is used to adjust the overlay settings.
Read more in the Overlay article.