Files
glsl_playground/basic/sunset.glsl
2017-06-05 15:03:57 -04:00

22 lines
474 B
GLSL

#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec3 sun = vec3(1.0*abs(sin(u_time)), .0, 0.4*abs(cos(u_time)));
vec3 pct = vec3(st.x);
vec3 color = sun;
color *= vec3(step(0.4, st.y));
if (step(0.4, st.y)<1.0) {
color = sun * vec3(smoothstep(0.2, 0.4, st.y));
color += vec3(0.3,0.2,0.9);
}
gl_FragColor = vec4(color,1.0);
}