- Home /
Overriding Default LWRP Terrain Shaders?
I'm having some trouble coming up with a non-intrusive way of overriding the default grass shaders for LWRP terrains.
Traditionally, we could just write our own shader and tag as with the hidden terrain shader
Shader "Hidden/TerrainEngine/Details/BillboardWavingDoublePass"
{
// ...
but with the LWRP-equivalent:
Shader "Hidden/TerrainEngine/Details/LightweightPipeline/BillboardWavingDoublePass"
{
// ...
This doesn't seem to work, as the files defining the LWRP shaders are included in the project itself and seem to take priority over the contents of /Assets
. We can go into /Library/PackageCache/<LWRP path>
and modify them directly there, but this is a really clunky way of doing things -- especially since /Library
is usually excluded from version control.
Is there an easier way to override these default LWRP shaders?
Answer by TreyH · Jun 04, 2019 at 01:27 PM
Answering myself to hopefully save others.
By default, there's a ScriptableObject called LightweightRenderPipelineEditorResources that keeps track of which Terrain Materials and Grass Shaders will be used.
Without a version of this object in your Assets Folder, it will always load the backup. That backup includes the default grass shaders.
To use your own shaders, you need a copy of that object in your Assets folder -- it just needs to exist there, no assignment necessary. You will need your own version of that, so I'm attaching the default one for convenience.
Zipped LightweightRenderPipelineEditorResources since you cannot shared *.asset files.
Once you have that, just drop in your custom grass shaders and you're ready to go.
In my case, it was to allow bending: