I’m getting some persistently irritating error messages for a shader I am working on. Despite the ease of reaching this error state, scouring Google for the error message yields little.
Here is the message I am getting:
Shader error in 'Custom/Flicker': Program 'SurfShaderInternalFunc', assignment among incompatible concrete types at line 22
Here is my shader:
Shader "Custom/Flicker" {
Properties {
_MainTex ("Texture", 2D) = "white" {}
_NoiseTex ("Noise Texture", 2D) = "white" {}
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float2 uv_MainTex;
};
sampler2D _MainTex;
sampler2D _NoiseTex;
float noiseChurn (float2 uv, float t) {
return tex2D (_NoiseTex, uv+t);
}
float flicker (float2 uv) {
float r;
r = noiseChurn(uv, _Time.y); // *** This is the offending line
r = noiseChurn(uv*10, r*100);
return r;
}
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb * flicker(IN.uv_MainTex);
}
ENDCG
}
Fallback "Diffuse"
}
What is weird is that I am assigning a float to a float, so I don’t know where the incompatibility lies. It looks to me like Cg really seems to hate assignment to local variables. Can anyone help me diagnose what’s going on?
Cheers!