Stylized Grass Shader Documentation

Stylized Grass Shader

Stylized Grass Shader
Version: 1.3.4
Review

11.Troubleshooting #

Grass only renders as shadows in Unity 2021.1

Right-click on the StylizedGrassShader/Shaders folder and choose re-import to nudge things back into place. This likely only needs to be done once, after upgrading to this version.

The issue lies with the fact that the files are importing normally, but the URP is updated afterwards. As a result, the shaders fail to find the URP shader libraries, unless they’re forced to refresh, this is done by reimporting the files.

Shadows still pop, even with LOD crossfading enabled

This appears to be a bug in URP itself, where the renderer only renders one single LOD for shadows, rather than LOD- & LOD+ with crossfading. This otherwise works properly for the normal shading.

The irony is that the only shader that uses LOD Crossfading is the SpeedTree leaf billboard shader, which in turn doesn’t support shadows. This is probably why Unity isn’t aware of this issue. Official LOD Crossfading support is being work on, so they’ll likely pick up on this.

Console errors

Assertion failed on expression: ‘0 == m_CurrentBuiltInBindMask’ UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

This is sometimes thrown when the shader recompiles, and appears to be a bug in Unity’s Async shader compiler. Fortunately, it’s harmless.

Shadows are flickering (fixed in Unity 2020.1+)

When using the Distance Fading or Perspective Correction feature, in conjunction with the terrain vegetation system shadows will appear to flicker.

This has been identified as a bug in the URP, and has been reported. It also occurs when placing the grass prefabs in the scene, and rendering *anything* using the terrain vegetation system. It is also reproducible in Shader Graph shaders.

Yes No Suggest edit
Last updated on May 27, 2022
2 of 2 users found this section helpful
Suggest Edit