- Home /
Cutout + Specularmask-shader error: "Material doesn't have a color property"
I'm making a transparent coutout-shader that should also support a mask for speculartint. On compiling, Unity gives me the errors "Material doesn't have a ... property" for every value the shader has. I'm pretty new to shaders, so any help will be greatly appreciated :)
Shader "Custom/Transparent_Cutout_Speculartint"
{
Properties
{
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
_Shininess ("Shininess", Range (0.03, 1)) = 0.5
_Cutoff("Cutoff", Range (0, 1)) = 0.5
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
_SpecTex ("Spec (RGB)", 2D) = "white" {}
}
SubShader
{
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 400
CGPROGRAM
#pragma surface surf BlinnPhong alpha
sampler2D _MainTex;
sampler2D _SpecTex;
half3 _Color;
half3 _SpecColor;
float _Shininess;
float _Cutoff;
struct Input
{
float2 uv_MainTex;
float2 uv_SpecTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 albedo = tex2D(_MainTex, IN.uv_MainTex) * _Color.rg;
fixed4 specTex = tex2D(_SpecTex, IN.uv_SpecTex) * SpecColor.rgb;
o.Albedo = albedo.rgb;
o.Gloss = specTex.rgb;
o.Specular = specTex.rgb;
if (albedo.a > _Cutoff)
o.Alpha = 1;
else
o.Alpha = 0;
}
ENDCG
}
Fallback "Transparent/VertexLit"
}
Comment