Search Unity

Multiple layers and transparency

Discussion in 'Shaders' started by Walibi33, Mar 31, 2014.

  1. Walibi33

    Walibi33

    Joined:
    Jul 25, 2013
    Posts:
    11
    Hello eveyone,

    I've been working on a Unity 3D viewer for almost a year and now, that our product works pretty decently, we are trying to overtake limits we encountered during the development step.

    More precisely, we must be able do display 3D humanoïd models wearing different kind of clothes put together with different kind of fabrics. That's why we had to handle bump mapping, light reflect effects (satin, velevet effects) and, of course, transparency. Most of the time the display is pretty good and matches our expectations but in case of multiple layers of transparent fabrics the result is not so good...

    Indeed to obtain good display results with transparency (in case of only one transparent layer, which is our nominal case : one human body wearing one transparent dress for instance) we had to enable ZWrite test. The problem is, with the ZWrite test enabled, once a pixel at a certain depth has been written the rendering engine no longer takes into account fragments from other fabrics that might be behind this pixel depth... That's why we usually see only the first level of multiple layers of transparent fabrics.

    I've done some searching about this issue, which is apprenlty well known in Unity today but I've never really found some documentation on how to resolve it so far.

    In order to obtain correct multiple layer transprency all triangles should be sorted from back to front before being rendered.

    Does anyone know a lead that could help me out with this issue ?

    Thanks in advance.
     
  2. monark

    monark

    Joined:
    May 2, 2008
    Posts:
    1,598
    Did you ever get this working? I'm hitting a similar issue with layered transparency shaders hiding objects behind them regardless of whether Zwrite is on or off.