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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Transparency sorting issues and Blend DstColor Zero.

Discussion in 'Shaders' started by chees502, Feb 27, 2016.

  1. chees502

    chees502

    Joined:
    Jan 25, 2014
    Posts:
    22
    I am trying to have multiple sets quads rendering black values and multiply that with the rest of the rendered frame. The only way I have found to have the quads blend together is turning ZWrite Off, introducing a new issue of objects sorting in front of it. If ZWrite is on, no blend occurs, and the whole quad occludes.
    Code (csharp):
    1.      Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    2.      Blend DstColor Zero
    3.      ZWrite Off
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,248
    Sounds like the material custom queue issue to me. Since Unity 5.0 if you set a shader on a material then change that shader's queue, the material ignores those changes. This is because the default behavior for Unity is now to set the material's custom queue to something which then overrides changes to the shader. To fix this you can change the shader on your material to something else and back, or you can right click on the inspector tab, select debug, and set the custom queue to -1, the default value prior to 5.0 that means "use the shader's queue".

    https://issuetracker.unity3d.com/is...-updated-until-shader-is-changed-and-reverted
     
  3. chees502

    chees502

    Joined:
    Jan 25, 2014
    Posts:
    22
    Thank you, works like a charm, I was not aware of that change.