Search Unity

Double-sided hair shading, how to handle backface?

Discussion in 'Shaders' started by bitinn, Dec 25, 2019.

  1. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    Hi all,

    I am facing a problem shading double-sided hair using common PBR shading, specifically, I think the backface shading is too bright when smoothness is high, can someone explain to me why this is and how we can fix it?

    Thx in advanced!
     
    Last edited: Dec 30, 2019
  2. bitinn

    bitinn

    Joined:
    Aug 20, 2016
    Posts:
    961
    I forgot to attach an image, so here it is, you can see the backface is much brighter, almost like basecolor is ignored or something.
     

    Attached Files:

  3. Invertex

    Invertex

    Joined:
    Nov 7, 2013
    Posts:
    1,550
    If all you've done it turn off back-face culling, then the normals rendered on the back of the face are pointing in the direction of the front of the face, so the lighting won't look consistent. You have to invert the normal if backface is being rendered. I believe there's a node if using shadergraph for determining that, and for manually written shaders there is the VFACE semantic.

    But also, you might want to bake an AO map for the hair to reduce lighting on the underside of the hair that is near the head.
     
    bitinn likes this.