Hi there,
I am quite new on Shaders.
I would like to know how to declare uniforms.
I am following the famous Bookofshaders. Where we have the following code:
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
vec3 colorA = vec3(0.149,0.141,0.912);
vec3 colorB = vec3(1.000,0.833,0.224);
void main() {
vec3 color = vec3(0.0);
float pct = abs(sin(u_time));
// Mix uses pct (a value from 0-1) to
// mix the two colors
color = mix(colorA, colorB, pct);
gl_FragColor = vec4(color,1.0);
}
However when I try to do the same in Unity I get an error coming from the declaration of the uniform:
Shader "ColorShader00" { // defines the name of the shader
SubShader { // Unity chooses the subshader that fits the GPU best
Pass { // some shaders require multiple passes
GLSLPROGRAM // here begins the part in Unity's GLSL
#ifdef VERTEX // here begins the vertex shader
void main() // all vertex shaders define a main() function
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
#endif // here ends the definition of the vertex shader
#ifdef FRAGMENT // here begins the fragment shader
uniform vec4 _SinTime
void main() // all fragment shaders define a main() function
{
vec3 colorA = vec3(0.149,0.141,0.912);
vec3 colorB = vec3(1.000,0.833,0.224);
float pct = abs(_SinTime.y));
// Mix uses pct (a value from 0-1) to
// mix the two colors
color = mix(colorA, colorB, pct);
gl_FragColor = vec4(color, 1.0);
}
#endif // here ends the definition of the fragment shader
ENDGLSL // here ends the part in GLSL
}
}
}
What am I doing wrong?