thebookofshaders/07/rect.frag

24 lines
470 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;
2015-03-31 16:04:59 +00:00
float rect(in vec2 st, in vec2 size){
size = 0.25-size*0.25;
vec2 uv = smoothstep(size,size+size*vec2(0.002),st*(1.0-st));
2015-03-15 15:35:14 +00:00
return uv.x*uv.y;
}
void main(){
vec2 st = gl_FragCoord.xy/u_resolution.xy;
2015-03-31 16:04:59 +00:00
vec3 color = vec3( rect(st, vec2(0.9) ) );
2015-03-15 15:35:14 +00:00
gl_FragColor = vec4(color,1.0);
}