I want to use the terrain engine to draw tree canopy by planting foliage (instead of trees)
In order to do that I need the terrain to be totally transparent so I replaced the terrain Vertex lighting shader by something like this:
SubShader {
Pass
{
Lighting Off
ZWrite Off
//Blend One Zero
ColorMask A
}
It works great in the editor : the terrain is invisible when set in lighting = vertex but in any player this seems overriden by the built in shader.
So there is a bug here (#??? still waiting) but until it gets fixed, how do I work around this ?
you have to assign the shader to a material then assign this material to any object e.g. a simple cube which is placed in your scene. otherwise the modified shader won’t get exported…
I’m trying to override the billboard shader, so I have placed the billboardshader from the buildin shaderlibary in my project, and added it to a cube. But it doesn’t replace the existing as I had hoped. I have tried manipulating all sorts of sensitive parts of this shader, and it has no effect. Is this not doable? I saw a post by Mr. J. Ante where he says you can override terrain shaders by adding a copy with the same name to the project. But?
If I understood well, there is a way to override the existing terrain material/shader ??
Could someone confirm this please ? and how exactly it is done.
Terrain inherits from MonoBehaviour, and MonoBehaviour has a ‘renderer’ variable. Thus, it is in theory possible to assign a new material to terrain renderer:
terrain.renderer.material = mymaterial;
It is possible to replace the existing terrain shaders. They need to be named the same and reside in a folder named Resources. Restarting Unity might be required.