Search Unity

Hdr Material With Alpha Not Visible From Certain Angles

Discussion in 'General Graphics' started by ceend, Apr 13, 2019.

  1. ceend

    ceend

    Joined:
    Jan 8, 2014
    Posts:
    12
    Hi,
    Please see screenshot. Alpha.png

    I have a head with numerous hair cards in the HDR pipeline. There are 4 different hair card mesh objects each consisting of poly object stripes and a material with alpha for fake realtime hair (the industry standard hair card approach). The top most hair mesh now is not visible from every angle. Its visibility pops in and out at different angle views. The 3 other meshes with alphas do not pop in and out. They work just fine.

    I guess Unity struggles with indentifying the normals render direction with several object underneath?

    I found similar solutions by changing the render queue value from 3000 to 3100 in debug mode of material. But that does not change my problem in this case. Is there somewhere a render queue value for a mesh?

    Any ideas what else could be the problem?



    Thx
     
    Last edited: Apr 13, 2019
  2. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    Is this transparent material? do they interpenetrate each others?
     
  3. ceend

    ceend

    Joined:
    Jan 8, 2014
    Posts:
    12
    Hi neoshaman,

    see here: Screen2.png

    Can you see any problems? I am new to this HDR thing and struggle on all ends.

    And yes the polygon strands intersect with each other
     
  4. neoshaman

    neoshaman

    Joined:
    Feb 11, 2011
    Posts:
    6,493
    That's a common problem with transparent shader since forever, since transparent are see through we can't use depth sorting using a depth buffer, as such transparent are rendered after opaque in back to front order. The problem is that interpenetration don't work well with this sorting, because you are either drawn before or after, so generally interpenetration is forbidden in game. The common practice these day is not use transparent but alpha cut out hair (ie opaque geometry compatible with depth sorting), with dithering to simulate transparency and some complex antialias solution to smooth other the edge, you will notice than in a lot of game, background characters with complex hair, they have this weird blurry halo in the hair (when in close up dialogue), it's cheap out processing on less important character.
     
  5. ceend

    ceend

    Joined:
    Jan 8, 2014
    Posts:
    12
    Appreciate your insight and help. Any best practices besides avoiding intersections for rendering fine structures with alpha maps inside Unity? Is there a guideline for cases like this somewhere on how to set up materials and rendering?
     
  6. ceend

    ceend

    Joined:
    Jan 8, 2014
    Posts:
    12
    Ok. I found a solution. I did duplicate the hair material and applied the 2 different materials. The top hair layr with the visibility problems got the new one. Now I gave the materials a different "Transparent sort priority" in the material and it worked now:
    screen3.png
     
    neoshaman likes this.