Pixel-Composer/shaders/sh_noise/sh_noise.fsh

20 lines
470 B
Plaintext
Raw Normal View History

2022-12-12 09:08:03 +01:00
//
// Simple passthrough fragment shader
//
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 dimension;
uniform float seed;
2023-01-09 03:14:20 +01:00
float random (in vec2 st, float seed) {
return fract(sin(dot(st.xy + seed, vec2(1892.9898, 78.23453))) * 437.54123);
2022-12-12 09:08:03 +01:00
}
void main() {
2023-01-09 03:14:20 +01:00
float n0 = random(v_vTexcoord, floor(seed) / 5000.);
float n1 = random(v_vTexcoord, (floor(seed) + 1.) / 5000.);
float n = mix(n0, n1, fract(seed));
2022-12-12 09:08:03 +01:00
gl_FragColor = vec4(vec3(n), 1.0);
}