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 Flatshaded terrain with different textures per quad depending on height

Discussion in 'Shaders' started by Blamanos, May 10, 2023.

  1. Blamanos

    Blamanos

    Joined:
    Jan 18, 2017
    Posts:
    1
    Hi! I recently started working with the shader graph in Unity, and I would like to achieve a flatshaded effect with different textures depending on the height of the mesh, like at 7:10 in this procedural terrain tutorial:

    As in the tutorial, I want the texture to be per quad, but still dependent on height.
    Right now, I have different textures based on height, and they have a lerp between them. But I want the cutoff between textures to be sharp and be per quad.

    How would I achieve this?
     
  2. topitsky

    topitsky

    Joined:
    Jan 12, 2016
    Posts:
    93
    make gradient texture, treat the normal as a uv coordinate, and tex2d(i.normal.y). use a flat normal mesh, or try squiggling it round()