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.
  2. Dismiss Notice

Question Multiple materials for terrain

Discussion in 'General Graphics' started by lc-gd, Sep 29, 2023.

  1. lc-gd

    lc-gd

    Joined:
    May 14, 2019
    Posts:
    5
    Hi!

    I would like to render a Unity terrain component using two different shaders in URP. One shader for standard rendering and second shader for rendering inflate outline for the terrain.

    As far as I know, the only way to render a mesh using two shaders in URP is assigning two distinct materials to a mesh renderer.

    I would like to use the same approach for Unity terrain. Unfortunately as far as I can see, there is only a single slot for material in terrain settings. Is it possible to assign two or more materials to Unity terrain somehow?
     
  2. adamgolden

    adamgolden

    Joined:
    Jun 17, 2019
    Posts:
    1,495
    You can do it with a Render Objects Render Feature, but the limitation is that because you can't assign a different layer to terrain details vs. the terrain itself, your outline would apply to terrain details also. That said, if that wouldn't be a roadblock in your particular use case, this might be a solution (as I've also noticed we can't assign multiple materials to the same terrain right now either, afaik). No response to my inquiry about this, yet:
    https://forum.unity.com/threads/how...-details-vs-terrain-gameobject-layer.1482885/
     
    lc-gd likes this.
  3. lc-gd

    lc-gd

    Joined:
    May 14, 2019
    Posts:
    5
    Thank for the info - that's very useful!
     
    adamgolden likes this.
  4. Nintynstor

    Nintynstor

    Joined:
    Dec 12, 2022
    Posts:
    9
    thanks for the info. I think this is useful for many
     
    adamgolden likes this.