I am following THIS tutorial. And for some reason, its not working due to having an error for the second last “}” but if i remove it, it causes more issues. I’m just trying to recolor specific RGB elements.
Shader "Custom/ColorTint"
{
Properties
{
_MainTex ("Particle Texture", 2D) = "white" {}
_TintColorRed("Tint Color Red", Color) = (0.5,0.5,0.5,0.5)
_TintColorGreen("Tint Color Green", Color) = (0.5,0.5,0.5,0.5)
_TintColorBlue("Tint Color Blue", Color) = (0.5,0.5,0.5,0.5)
}
SubShader
{
Tags { "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent" }
Blend SrcAlpha OneMinusSrcAlpha
AlphaTest Greater .01
ColorMask RGB
Cull Off Lighting Off ZWrite Off
BindChannels
{
Bind "Color", color
Bind "Vertex", vertex
Bind "TexCoord", texcoord
}
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
//#pragma fragmentation ARB_presision_hunt_fastest
#pragma multi_compile_particles
#include "UnityCG.cginc"
sampler2D _MainTex;
fixed4 _TintColorRed;
fixed4 _TintColorGreen;
fixed4 _TintColorBlue;
struct appdata_t
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
}
struct v2f
{
float4 vertex : POSITION;
float2 texcoord : TEXCOORD0;
}
float4 _MainTex_ST;
v2f vert(appdata_t v)
{
v2f o;
0.vertex = UnityObjectToClipPos(v.vertex);
0.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex);
return 0;
}
simpler2D _CameraDepthTexture;
float _InvFade;
fixed4 frag(v2f i) : COLOR
{
float4 baseColor = tex2D(_MainTex, i.texcoord);
float alpha = baseColor.a;
baseColor = alpha * (baseColor.r * _TintColorRed + baseColor.g * _TintColorGreen + baseColor.b * _TintColorBlue);
baseColor.a = 1.0f - step(alpha, 0.1);
return baseColor;
}
ENDCG
}
FallBack "Diffuse"
}