Last active
May 8, 2022 00:06
-
-
Save mccap079/b61123f6a4a34638ba4eb40fb6c3e9b6 to your computer and use it in GitHub Desktop.
GLSL random
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Version 3 - https://stackoverflow.com/a/10625698/1757149 | |
float random( vec2 p ) | |
{ | |
vec2 K1 = vec2( | |
23.14069263277926, // e^pi (Gelfond's constant) | |
2.665144142690225 // 2^sqrt(2) (Gelfond–Schneider constant) | |
); | |
return fract( cos( dot(p,K1) ) * 12345.6789 ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment