Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

How to override the terrain shader ?

Discussion in 'Shaders' started by oxium, Jul 18, 2010.

  1. oxium

    oxium

    Joined:
    May 25, 2010
    Posts:
    28
    Hi all,

    I'd like to override the terrain shader from script..
    Any idea how this can be done ?
    I've seen some terrain projects but they seem to hack unity instead of setting the shader properly
    Also I don't want to use the terrain "as a terrain", it's more about using the LOD tesselation feature of the terrain and use it for "something else"
    Let me know if I'm totally wrong
    Cheers
    oX
     
  2. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can't override it from script.

    you can decide if you want to replace it or not, and that will happen globally. There is no material on terrains where you can access a shader or alike.

    you do this overriding by creaing a new shader that does what the old does and give it the same identification name.
    there is a thread on the showcase board with an enhanced terrain shader with normal mapping to show that.
     
  3. ToreTank

    ToreTank

    Joined:
    Jun 23, 2008
    Posts:
    165
    It is also possible to use custom shaders for the terrain using Replacement Shaders with a sensible camera culling mask.
     
  4. smtabatabaie

    smtabatabaie

    Joined:
    May 6, 2013
    Posts:
    44
    Hi , I'm struggling with the same problem of how to override and modify the shader of a terrain.
    How can we know what is the identification name of the terrain . I'll also appreciate if you can give me a link on the thread you mentioned .
    thanks very much
     
  5. Prince_of_Persia

    Prince_of_Persia

    Joined:
    Oct 20, 2012
    Posts:
    49
    Get the source of built-in shaders for unity . And then find the Terrain shader and modify it , put it in your project.