Search Unity

Per pixel normals support in custom terrain shader

Discussion in 'Shaders' started by RobinKarlegrund, Aug 29, 2019.

  1. RobinKarlegrund

    RobinKarlegrund

    Joined:
    Feb 26, 2019
    Posts:
    7
    Does anyone know how i would go about adding support for per pixel normals in my terrain shader, I've been searching around and can't really find any forum threads or articles talking about the subject. Please help :(
     
  2. RobinKarlegrund

    RobinKarlegrund

    Joined:
    Feb 26, 2019
    Posts:
    7
    no one at all with any input about this subject?
     
  3. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I’m curious about this too. I’m trying to get unity terrain per pixel normal maps working with microsplat custom shaders
     
  4. RobinKarlegrund

    RobinKarlegrund

    Joined:
    Feb 26, 2019
    Posts:
    7
    I believe that if you're using microsplat then it should be as simple as enabling draw instanced on your terrain
     
    protopop likes this.
  5. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    Terrain draw instancing worked. Thank you.
     
  6. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    You can basically look at Unity's shader source and copy the code from in there. It's pretty straight forward.
     
    protopop likes this.
  7. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    I’m not that good with shader code, yet:) but terrain instancing worked and added the per pixel terrain normals automatically, and I added a toggle To make sure I don’t use anisotropy and instanced terrain together (which causes a visual bug)
     
  8. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    Oh I was answering the original poster.
     
    protopop likes this.
  9. protopop

    protopop

    Joined:
    May 19, 2009
    Posts:
    1,561
    whoops:)