audio-vis/shaders/wave.frag

23 lines
494 B
GLSL
Raw Normal View History

2020-04-05 15:28:22 +02:00
#version 300 es
precision mediump float;
in vec4 pos;
in vec3 v_surfaceToLight;
2020-08-07 19:31:30 +02:00
uniform vec3 u_baseColor;
uniform vec3 u_maxColor;
uniform float u_light;
2020-04-05 15:28:22 +02:00
out vec4 outColor;
void main() {
vec4 fragNormal = normalize(pos);
float light = max(dot(fragNormal.xyz, normalize(v_surfaceToLight).xyz), u_light);
float y = pos.z;
if (y < 0.0) {
y = y * -1.0;
}
2020-08-07 19:31:30 +02:00
vec3 color = mix(u_baseColor, u_maxColor, y);
2020-08-01 21:51:54 +02:00
outColor = vec4(color, 1.0);
outColor.rgb *= light;
2020-04-05 15:28:22 +02:00
}