Created
June 13, 2015 23:54
-
-
Save doxas/ebeac1351053e643be43 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#define PI 3.14159265 | |
float perlin(vec3 p){ | |
vec3 i = floor(p); | |
vec4 a = dot(i, vec3(1.0, 57.0, 21.0)) + vec4(0.0, 57.0, 21.0, 78.0); | |
vec3 f = cos((p - i) * PI) * (-0.5) + 0.5; | |
a = mix(sin(cos(a) * a), sin(cos(1.0 + a) * (1.0 + a)), f.x); | |
a.xy = mix(a.xz, a.yw, f.y); | |
return mix(a.x, a.y, f.z); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment