- Home /
Gameobjects with same shader are appering through eachother
I having problems with a shader. I don't know enough about shaders to fix this myself. I Imported a custom shader, so my object could have a fade effect before it gets destroyed. (i.e changing the material's alpha value with the custom shader), but now I've got this problem
(With Custom shader)
(Without custom shader)
Shader code:
Shader "Custom/NewSurfaceShader"
{
Properties
{
_Color("Color", Color) = (1,1,1,1)
_MainTex("Albedo (RGB)", 2D) = "white" {}
_Glossiness("Smoothness", Range(0,1)) = 0.5
_Metallic("Metallic", Range(0,1)) = 0.0
_Visibility("Visibility", Range(0,1)) = 1
}
SubShader
{
Tags {"RenderType" = "Transparent" "Queue" = "Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Standard fullforwardshadows alpha:fade
#pragma target 3.0
sampler2D _MainTex;
float _Visibility;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf(Input IN, inout SurfaceOutputStandard o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = _Visibility;
}
ENDCG
}
FallBack "Standard"
}
with-custom-shader.png
(65.2 kB)
without-custom-shader.png
(54.4 kB)
Comment
Your answer
Follow this Question
Related Questions
Fog Mode Off Functionality 1 Answer
viewDir changes with o.Normal 1 Answer
GrabTexture is always empty 1 Answer
Merge 2 shaders 0 Answers
Issue with shader tint color 0 Answers