Stylized Grass Shader Documentation

Stylized Grass Shader

Stylized Grass Shader
Version: 1.4.2

9.Troubleshooting #

Shader error: Failed to include source file Libraries/<filename>hlsl

The error is absolutely false, since the file it refers to is actually there. But sometimes Unity’s shader compiler messes up the importing order, or caches too aggressively. 

You can right-click on the Shaders folder and choose “Re-import”, to give the compiler a good kick. You may need to delete the Library/ShaderCache folder from your Unity project (perfectly safe!), in order to really-really clear the faulty compiled shader.

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.

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 June 5, 2023
3 of 3 users found this section helpful
Suggest Edit