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.
- Import Nature Shaders
- Select a shader for your material
- Assign textures
- Enable wind
- Enable interaction
- Tweak more settings
Step 1: Import Nature Shaders
If you have Nature Renderer or Open World Nature Kit in your project then you should already have Nature Shaders in your project as well. If not, then you can download the early access version of Nature Shaders.
Step 2: Select a shader for your material
Nature Shaders is a collection of shaders that you can use for your materials. So the natural first step is to select one of the shaders for your material.
Select your material, and change the shader to one of the following:
- Nature Shaders/Grass
- Nature Shaders/Vegetation
- Nature Shaders/Tree Leaves
- Nature Shaders/Tree Bark
Note: For the High-Definition render pipeline, the shaders are located in the HDRP sub-category. For the Universal render pipeline, the shaders are located in the Universal Render Pipeline sub-category.
Each shader represents a different type of object, and should be selected for the corresponding object type:
The "Vegetation" shader is the most versatile and can be used for most objects.
"Grass" has a slightly different behavior that is more optimized for grass patches. Most notably, it has more wind variation within the object, and recalculates normals when bending in the wind.
Tree Leaves and Tree Bark
The tree shaders should only be used for trees. They are optimized for more complex wind animations, including bending of the trunk.
Step 3: Assign textures
Most likely your material will already have assigned textures, but you may have to re-assign them. The texture fields that are available depend on the Surface Map Method that is selected. "Metallic Gloss" uses the same textures as the built-in render pipeline and URP. "Mask" uses the same textures as HDRP.
Make sure that "Alpha Clipping" is enabled if your material requires transparency.
Read more in the Material Editor article.
- Albedo: A texture containing the base color for the material.
- Normal: A texture containing the normal map for the material. Adjust the normal strength with the slider.
- Glossiness, Metallic: A texture containing the smoothness/roughness and metallic values of the material. Use the slider to remap the smoothness/roughness. The channels use the same format as the mask map (see the table below).
- Occlusion: A texture containing the occlusion of the material. Use the slider to remap the occlusion.
- Mask Map: The mask map contains four grayscale textures, one in each of its color channels. Use the Smoothness and Occlusion properties to remap the values of the textures.
Step 4: Enable wind
Wind is enabled by default, but still needs to be set up for your material, and in the scene.
The most important setting is the "Wind Control" field. This field determines what data is used for wind animations. All other fields can be left at the default values for most materials.
Read more in the Material Editor article.
When set to "Automatic", a simple representation of your object is calculated based on it's height and radius. You need to set the value of the Height field to accurately match the height of your object. As well as the Radius (for trees).
When set to "Baked", the shape of your object is loaded from the vertex colors. This should only be used when you specifically set up your model to be used with Nature Shaders' wind.
The scene needs an object with a Global Wind component to set the wind settings that should be used in the scene.
- Create a new Game Object in the scene.
- Select the Game Object and click Add Component in the inspector to add a new component.
- Select "Global Wind" in the Add Component menu to add the Global Wind component to the game object and enable wind in the scene.
- Select a wind preset from the Load Preset drop-down. Or drag the sliders to adjust the wind strength.
Step 5: Enable interaction
Click "Enable" in the interaction section to enable interaction for this material. If enabled, objects in the scene will interact with vegetation that uses this material, causing the vegetation to sway.
Other objects in the scene that should interact with the vegetation need a Nature Collider component.
Read more in the article about Object Interaction.
Step 6: Tweak more settings
You should now have a correctly working material. If you want to tweak your material even further then take a look at the following sections:
You can change the color of your material, and even add color variations so that there is some variation between objects in your scene.
Light can shine through your objects, so that the backside is slightly lit. This gives a natural look for your vegetation.
Or read through the full Material Editor article, to see all available settings.