- Home /
Other
I have transparent shader, but after quad with it material all objects with not default sorting layer are unvisible
I'm doing the fog of war in 2d game. But through the material with shader are visible only objects with sorting layer = default. If i changed sorting layer to something else then object disappeared
Some objects have only sprite renderer. Camera is ortographic.
That is shader which i use
Shader "Custom/FogOfWarCG" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Transparent" "Queue" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
Cull Off
LOD 200
Lighting off
pass {
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#include "UnityCG.cginc"
uniform sampler2D _MainTex;
fixed4 frag(v2f_img i) : SV_Target {
return tex2D(_MainTex, i.uv);
}
ENDCG
}
}
FallBack "Diffuse"
}
Why this happens?
Hi! Have you checked you camera's Culling mask settings? If the layer you are using is disabled in the camera it will not render it.
Follow this Question
Related Questions
Make a complex object semi transparent without changing it 2 Answers
I have transparent areas in my sprite, how can they show up as transparent in Unity? 1 Answer
What is the best way to draw a 2D sine wave? 3 Answers
Replicate CSS3 animation in Unity 0 Answers
Prefab's High poly mesh VS lower poly transparency cutout 2 Answers