Small noise / random function in GLSL:
varying vec3 v; float rand(vec2 n) { return 0.5 + 0.5 * fract(sin(dot(n.xy, vec2(12.9898, 78.233)))* 43758.5453); } void main(void) { float x = rand(v.xz); gl_FragColor = vec4(x, x, x, 1.0); }
Noise function tested in GeeXLab (OpenGL 2):
How random is this? Can you point me somewhere for further explanation/analysis of the generator?
Thanks, awesome trick 🙂