is it possible to change shader of terrain details/billboards?

i have a billboard texture which looks great when just applied to a quad as standard material.

but when i use same image as a detail texture it seems downsized, no edge fidelity (soft edges are cropped off) and isnt lit, or casting shadows

i understand these adjustments will be to increase performance
and the alpha cut off threshold is removing any soft edges

is there a way to override the material shader of details so they appear same/closer to a normal shader?

but still use unity’s detail drawing for distance/quantity etc?

(quads are in foreground, painted details behind)

any help appreciated, thanks i been searching for where the shader is even located in project folder to see if it can be edited manually but i cant even seem to find which shader file for this purpose?

not sure if the cropping at the base is because of alpha cut off or if somehow a difference in detail-texture setting has hacked the bottom off either way i now have a ruler-straight edge where with standard shader my soft edge is visible?

4 Answers

4

One approach is to use the built in shader source code as a starting point and then make modifications from there. Here’s how:

  1. Download built in shader sources for your version of unity from the [unity archive page][1]. Select the Downloads drop down menu and then choose Built in shaders.
  2. Exract the downloaded shaders zip to a folder.
  3. Drop the folder into your unity assets.

At this point the downloaded shaders you dropped in will override the built-in shaders because they have the same names as the built-in shaders.

To modify the grass billboard shader in Unity 2017.2.0f3, find the WavingGrassBillboard shader located in the builtin_shaders-2017.2.0f3/DefaultResourcesExtra/TerrainShaders/Details folder.

104984-capture2.png

Here’s an example changing the shader to output red instead of the texture color.

If you name your shader the same as the one Unity uses, yours will override it.

For example: “Hidden/TerrainEngine/Details/Vertexlit”

In your case, you’d want the one used for grass.

Source:
https://forum.unity3d.com/threads/terrain-detail-mesh-normal-map.176806/

Does this also work in newer versions of Unity? I tried to replace the Internal-DeferredShading Shader, but Unity wont use the altered version.

@HowlingMoonSoftware thanks for the reply! (only just had notification of this) And the link :slight_smile: (hoping i can now make some progress with better vegetation because the stock shader is well limiting with the no shadows and the fact it slices the base off everything creating the sharp edge is frustrating when been careful to not have that on source texture)

I can recommend SE Screen space shadows by Sonic Ether if you're just looking for shadows on the grass. Performance is great and it looks fantastic.

In case someone has the same issue with URP, here is my solution for 2019.4.13: https://forum.unity.com/threads/2019-2-overriding-shaders-of-terrain-grass.725294/page-2#post-6863873

Hope it helps :slight_smile:

thank you for taking time out to update with a follow up, and sharing the knowledge