thebookofshaders/07/circle.frag

25 lines
536 B
GLSL
Raw Normal View History

2015-03-15 15:35:14 +00:00
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
2015-03-21 13:02:43 +00:00
2015-03-15 15:35:14 +00:00
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
2015-04-02 17:43:22 +00:00
uniform vec2 u_mouse;
2015-03-15 15:35:14 +00:00
uniform float u_time;
float circle(in vec2 _st, in float _radius){
2015-11-17 14:36:46 +00:00
vec2 dist = _st-vec2(0.5);
2015-03-15 15:35:14 +00:00
return 1.-smoothstep(_radius-(_radius*0.01),
_radius+(_radius*0.01),
2015-11-17 14:36:46 +00:00
dot(dist,dist)*4.0);
2015-03-15 15:35:14 +00:00
}
void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy;
vec3 color = vec3(circle(st,0.9));
gl_FragColor = vec4( color, 1.0 );
}