Search Unity

Transparent Diffusr shader problem. Done.

Discussion in 'Shaders' started by Neodrop, Feb 11, 2010.

  1. Neodrop

    Neodrop

    Joined:
    Oct 24, 2008
    Posts:
    1,359
    I have bad situation with Transparent/Diffuse shader.

    May be someone can help me?
    Tranpsrent/Cutout/Diffuse work fine, but I can't use it.
    Whats wrong?

    Transparent/Diffuse


    Tranpsrent/Cutout/Diffuse
     
  2. Neodrop

    Neodrop

    Joined:
    Oct 24, 2008
    Posts:
    1,359
    Done. Zwrite On and all fine.


     
  3. savage

    savage

    Joined:
    Feb 11, 2010
    Posts:
    3
    I know this is an old thread but I do have the exact same problem in my project. I have already spent lots of time searching for how to set "Zwrite On" to an existing shader like the Transparent/Diffuse and I was not able to get any hints.

    could anybody please explain me how to do so?

    THANKS A LOT georg
     
  4. Neodrop

    Neodrop

    Joined:
    Oct 24, 2008
    Posts:
    1,359
    At first, take the standart shaders sources there : http://unity3d.com/support/resources/assets/built-in-shaders

    Choose Alpha-Diffuse.shader and put it in your project folder.

    Double-click for open code editor.

    Find and comment this line : //Zwrite off



    Change the shader name to something like Shader "Transparent/Diffuse+"

    Close the code editor.

    Assign your modified shader to your material.
    Enjoy.
     
  5. Daniel_Brauer

    Daniel_Brauer

    Unity Technologies

    Joined:
    Aug 11, 2006
    Posts:
    3,355
    You might find this shader does a better job, because it writes to the Z buffer in a pre-pass. This approach prevents triangles in non-convex models from being drawn in the wrong order.
     
  6. savage

    savage

    Joined:
    Feb 11, 2010
    Posts:
    3
    Fist of all a big thank you to Neodrop. Your tutorial works like a charm!!

    @Daniel: thats a really compact shader, looks interesting. I will definitly try that too, since I now know how to work with custom shaders.
     
  7. qamarzaman

    qamarzaman

    Joined:
    Jul 1, 2010
    Posts:
    85
    Neodrop

    I could not Find this line in Shader file you referred.

    Here is What is in Alpha-Diffuse.shader

     
  8. gvaughan

    gvaughan

    Joined:
    Jan 28, 2010
    Posts:
    32
    You sir, are a hero for this link :)
     
  9. Piesk

    Piesk

    Joined:
    Sep 23, 2013
    Posts:
    14
    Neo which package do we download? the alpha diffuse shader from the most recent package is very different from the one showed in you image. (thank you for this help btw).