- Home /
Unlit transparent shader render order issue
In using the unlit transparent shader, I've noticed that often times it will render improperly in front of or behind certain objects. The only solution I've been able to find as of yet is instead using a transparent/cutout/soft edge unlit shader which does render in the proper order, but however has a different visual appearance than the unlit transparent shader. Is there a working shader that does what the unlit transparent shader does, or another fix to resolve this issue?
Answer by equalsequals · Jun 28, 2011 at 07:03 PM
This shader, for performance reasons doesn't write to the Z buffer.
If I understand you correctly, this will solve your problem:
Shader "Unlit/Transparent ZWrite" {
Properties {
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
Lighting Off
SetTexture [_MainTex] { combine texture }
}
}
}
Hope that helps
==
Thanks equalsequals. This shader renders in the proper order. I realized though after testing the shader that I forget to mention that I was using other custom shaders which may be causing the problem. Since that is outside of the scope of this topic, I'm going to post it as a new question.
Your answer
Follow this Question
Related Questions
Android shader (transparency) problem with 3.4 1 Answer
Unlit Transparent Shader 0 Answers
2D Toolkit in 3D world 1 Answer
Unlit/Transparent Shader code. 2 Answers
How to get vertex color's alpha channel to work in URP 1 Answer