Created
March 1, 2023 10:11
-
-
Save wonglok/28194778969265efce73d0f69d6a1455 to your computer and use it in GitHub Desktop.
pattern xyy.glsl
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
const float MY_PI = 3.14159265; | |
const float MY_SCALE = 1.0; | |
const mat3 m = mat3( | |
cos(MY_PI * MY_SCALE), -sin(MY_PI * MY_SCALE), 0.0, | |
sin(MY_PI * MY_SCALE), cos(MY_PI * MY_SCALE), 0.0, | |
0.0, 0.0, 1.0 | |
); | |
float noise( in vec3 p ) { | |
return cos(p.x) * sin(p.y) * cos(p.z); | |
} | |
float fbm4( vec3 p ) { | |
float f = 0.0; | |
f += 0.5000 * noise( p ); p = m * p * 2.02; | |
f += 0.2500 * noise( p ); p = m * p * 2.03; | |
f += 0.1250 * noise( p ); p = m * p * 2.01; | |
f += 0.0625 * noise( p ); | |
return f / 0.9375; | |
} | |
float fbm6( vec3 p ) { | |
float f = 0.0; | |
f += 0.500000*(0.5 + 0.5 * noise( p )); p = m*p*2.02; | |
f += 0.250000*(0.5 + 0.5 * noise( p )); p = m*p*2.03; | |
f += 0.125000*(0.5 + 0.5 * noise( p )); p = m*p*2.01; | |
f += 0.062500*(0.5 + 0.5 * noise( p )); p = m*p*2.04; | |
f += 0.031250*(0.5 + 0.5 * noise( p )); p = m*p*2.01; | |
f += 0.015625*(0.5 + 0.5 * noise( p )); | |
return f/0.96875; | |
} | |
float pattern (vec3 p) { | |
float vout = fbm4( p + time + fbm6( p + fbm4( p + time )) ); | |
return abs(vout); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment