thebookofshaders/10/2d-random.frag

25 lines
451 B
GLSL
Raw Normal View History

2015-03-15 15:35:14 +00:00
// Author @patriciogv - 2015
// http://patriciogonzalezvivo.com
2015-05-05 14:19:16 +00:00
2015-03-15 15:35:14 +00:00
#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
2015-05-01 20:05:55 +00:00
uniform vec2 u_mouse;
2015-03-15 15:35:14 +00:00
uniform float u_time;
2016-01-01 00:45:12 +00:00
float random (vec2 st) {
2015-07-23 14:02:53 +00:00
return fract(sin(dot(st.xy,
2016-01-01 00:45:12 +00:00
vec2(12.9898,78.233)))*
2015-03-15 15:35:14 +00:00
43758.5453123);
}
void main() {
vec2 st = gl_FragCoord.xy/u_resolution.xy;
float rnd = random( st );
gl_FragColor = vec4(vec3(rnd),1.0);
2017-08-19 10:11:58 +00:00
}