- Home /
Basic Shader is Hiding Sprite but I Don't Know Why
I just started to get my feet wet with shaders but I can't come up with anything reason as to why my shader keeps my sprite hidden here. This code is intended to create an outline of the sprite:
Shader "Custom/SpriteOutlineShader"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
_Color("Color", Color) = (1, 1, 1, 1)
}
SubShader
{
Cull Off
Pass
{
CGPROGRAM
#pragma vertex vertexFunc
#pragma fragment fragmentFunc
#include "UnityCG.cginc"
sampler2D _MainTex;
struct v2f
{
float4 pos : SV_POSITION;
half2 uv : TEXCOORD0;
};
v2f vertexFunc(appdata_base v)
{
v2f o;
o.pos = UnityObjectToClipPos(v.vertex);
o.uv = v.texcoord;
return o;
}
fixed4 _Color;
float4 _MainTex_TexelSize;
fixed4 fragmentFunc(v2f i) : COLOR
{
half4 c = tex2D(_MainTex, i.uv);
return c;
}
ENDCG
}
}
}
What exactly is happening here? In what sense is it hiding the sprite, and how are you using the shader? All this shader does is display the source texture as is, so I'm assu$$anonymous$$g you're implementing the 'outline' in some other way?
Your answer
![](https://koobas.hobune.stream/wayback/20220612205722im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Unity 2D Shader Graph Sprite transparent when in shadow 0 Answers
Render a sprite only when it's on the parent but not other sprites. 0 Answers
grayscale shader on iOS turns black 1 Answer
How to fix this kind of shader error? 0 Answers
Can I map a 2nd texture onto a sprite that's already mapped with an atlas? 0 Answers