Created
June 20, 2018 21:47
-
-
Save psql/b980dad66b6725e5f4c04cd0976c6bc5 to your computer and use it in GitHub Desktop.
range map.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
#define PI 3.14159265359 | |
float plot(vec2 st, float pct){ | |
return smoothstep( pct-0.01, pct, st.y) - | |
smoothstep( pct, pct+1.0, st.x); | |
} | |
void main() { | |
vec2 st = gl_FragCoord.xy/u_resolution; | |
float y = st.x * cos(st.x / u_time) * sin(u_time*st.x); | |
vec3 color = vec3(y); | |
// Plot a line | |
float pct = plot(st,y); | |
color = (1.0/pct)*color+pct*vec3(0.479, 0.294, 0.738); | |
gl_FragColor = vec4(color,1.0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment