Home > other >  The problem of transparent Shader
The problem of transparent Shader

Time:09-20

A cutting the display of the shader object, set up a "Queue"="Transparent" will such (pictured),
Feeling is caused by deep inspection, but even the depth detection, in the various parameters, there are still problems.


If change the tag to a "Queue"="AlphaTest.". Covering the inside and may not be able to show... Understand.


Shader code as follows.. The great spirit guide...
 

Shader LCC/Bumped "Diffuse" {
The Properties {
_Color (" Main Color ", Color)=(1,1,1,1)
_MainTex (" Base (RGB) Gloss "(A), 2 d)=" white "{}
_Illum (" Illumin "(A), 2 d)=" white "{}
_BumpMap (" Normalmap ", 2 d)="bump" {}
_EmissionLM (" Emission (Lightmapper) ", Float)=0
_ForwardLength (" Forward ", Float)=0
}
SubShader {
Tags {" Queue "=" AlphaTest "" IgnoreProjector"="True" "RenderType"="Transparent"}
Cull off
//ZWrite off
//ZTest LEqual

CGPROGRAM
# pragma surface surf Lambert alpha vertex: vert

Sampler2D _MainTex;
Sampler2D _BumpMap;
Sampler2D _Illum;
Fixed4 _Color;
Float _ForwardLength;

Struct Input {
Float2 uv_MainTex;
Float2 uv_Illum;
Float2 uv_BumpMap;
Float3 vertPos;
};

Void vert (inout appdata_full v, out Input o {
UNITY_INITIALIZE_OUTPUT (Input, o);
O.v ertPos=v.v ertex;
}
Void surf (Input IN and inout SurfaceOutput o {
Fixed4 Tex=tex2D (_MainTex, IN uv_MainTex);
Fixed4 c=Tex * _Color;
O.A lbedo=c.r gb;
O.E mission=c.r gb * tex2D (_Illum, IN. Uv_Illum). A;
O.N ormal=UnpackNormal (tex2D (_BumpMap, IN uv_BumpMap));

If (IN) vertPos) z> _ForwardLength) {
O.A lpha=c.a.;
} else {
O.A lpha=0;
}
}
ENDCG
}
FallBack "Self - Illumin/Diffuse"
}



  • Related