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 Properly intersecting alpha-mapped quads? (like grass billboards)

Discussion in 'Shader Graph' started by linenum, Jul 22, 2023.

  1. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    42
    I've seen tutorials talking about grass made out of intersecting quads but when I try it the intersection isn't handled properly - it seems to draw one quad completely then the other.
    intersecting1.JPG
    I've tried every option in the shader graph for depth write and depth test - but none give the desired results.

    The best I've been able to do is add two more quads so there is no intersection: (where each quad is a separate object - taking up 1/4 or one side of it)
    intersecting3.JPG
    When I tried combining the four quads into a single mesh it behaves like two intersecting quads even though the vertices aren't joined - I turned "weld vertices" in FBX import off - and even tried leaving a gap between the quads....
    intersecting4.JPG

    Is there some way of making two quads intersect properly?
     
    Last edited: Jul 22, 2023
  2. EricFFG

    EricFFG

    Joined:
    May 10, 2021
    Posts:
    176
    you need to take alpha clipping not transparency
    Transparency will be extremely expensive and its sorting is not really solved (?) in computer graphics
    Also pro tip is to take only a triangle each
     
  3. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    42
    I enabled "Alpha Clipping" in the shader options and it seems to still have the same rendering problem. As far as transparency goes, in the built-in shader graph it only has the options of "Opaque" and "Transparent".
    My grass/flowers are like Minecraft (i.e. not millions in view) and can be painted (not static) and are more about efficient use of textures rather than reducing the triangles... if I am using four different objects for the parts then I can't seem to paint them simultaneously with the same texture...
     
    Last edited: Jul 25, 2023
  4. BenCloward

    BenCloward

    Unity Technologies

    Joined:
    Jul 15, 2021
    Posts:
    93
    Set it to "Opaque" - not "Transparent"
     
    linenum likes this.
  5. linenum

    linenum

    Joined:
    Nov 16, 2020
    Posts:
    42
    Thanks! I set it to "opaque" and "alpha clipping" and it works!
    intersecting5.JPG
    The alpha clipping boundary isn't smooth but that's ok.
     
    Last edited: Jul 25, 2023
  6. BenCloward

    BenCloward

    Unity Technologies

    Joined:
    Jul 15, 2021
    Posts:
    93
    You're welcome. Glad I could help.
     
    linenum likes this.