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

alpha channel on PNG texture draws the faces out of order.

Discussion in 'Scripting' started by From-Soy-Sauce, Aug 31, 2014.

  1. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Hello, I have a character made in Maya that has some PNG textures. The Hair has an alpha channel. They look fine in Maya, but when I loaded it into Unity the hair glitched up. How do I fix this?
     
  2. Dark-Protocol

    Dark-Protocol

    Joined:
    Nov 19, 2011
    Posts:
    279
    Use a transparent cutout shader instead of alpha-blended. Alpha blended shaders have issues with the z-buffer as you cannot write a semi-transparent pixel into it and determine the correct position. That's why transparent objects are queued according to their position in world space.
     
  3. From-Soy-Sauce

    From-Soy-Sauce

    Joined:
    Jan 7, 2014
    Posts:
    162
    Well I suppose that works. But is there no way to have it drawn with the correct Z-Buffer and contain semi-transparency?

    Also something else became apparent to when I put it your fix. Errors of the smooth angle. How can I get it to where all of the sharp edges are smoothed out?
     
  4. Dark-Protocol

    Dark-Protocol

    Joined:
    Nov 19, 2011
    Posts:
    279
    Unfortunately no, or at least not that I know of. I've been strugglilg with the same thing, trying different shaders and settings. To summarize: if you're using an alpha blended shader, there's no way for Unity to know exactly which part of the model should be drawn first and if you use a cutout shader, you can't have semi-transparency and you get jaggy edges. Sadly there is no other alternative so far so you just have to choose between one of these.

    I think the topic shold be moved to the Shader board