Daily Creative Coding

元「30 min. Processing」。毎日、Creative Codingします。

【GLSL】2次元のホワイトノイズ

See the Pen 2D white noise by aadebdeb (@aadebdeb) on CodePen.

precision mediump float;

uniform float u_time;
uniform vec2 u_mouse;
uniform vec2 u_resolution;

float random(vec2 st) {
  return fract(sin(dot(st.xy, vec2(12.9898, 78.233))) * 43758.5453123);
}

void main(void) {
  vec2 st = fract((gl_FragCoord.xy + vec2(u_time * 0.001)) / u_resolution);
  float v = random(st);
  gl_FragColor = vec4(vec3(v), 1.);
}

f:id:aa_debdeb:20170402173044p:plain