I know next to nothing about shaders but have been able to get this one to do most of what I need:
Shader "Custom/SpriteShadowCutout" {
Properties{
_Color("Main Color", Color) = (1,1,1,1)
_MainTex("Base (RGB) Trans (A)", 2D) = "white" {}
_Cutoff("Alpha cutoff", Range(0,1)) = 0.5
}
SubShader{
Tags {
"Queue" = "AlphaTest"
"IgnoreProjector" = "True"
"RenderType" = "TransparentCutout"
}
Cull off
CGPROGRAM
#pragma surface surf Lambert vertex:vert alphatest:_Cutoff addshadow
sampler2D _MainTex;
fixed4 _Color;
void vert(inout appdata_full v) {
if (dot(normalize(ObjSpaceViewDir(v.vertex)), v.normal) < 0)
{
v.normal = -v.normal;
}
}
struct Input {
float2 uv_MainTex;
};
void surf(Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/Cutout/VertexLit"
}
I need to add a “color swap” that will take anything grayscale and swap it with a custom color. I’ve found working “color swap” shaders but cannot seem to cobble the two together (shaders confuse the hell out of me).
I am working on a character customization feature whereby most of the assets are pre-drawn and colored, but the skin tone is variable (represented by grayscale).
I would appreciate anyone who could help me take this shader and add this feature to it. I am shader illiterate, so my apologies in advance if this is silly request.
6459853–724252–SpriteShadowCutout.shader (859 Bytes)
