Created
April 21, 2021 09:42
-
-
Save hatkidchan/986a39a6723d98b2edb8d40432dec573 to your computer and use it in GitHub Desktop.
Some crappy noise
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
// Author: hatkidchan (https://github.com/hatkidchan) | |
// Title: noise? | |
// Open in: https://thebookofshaders.com/edit.php | |
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform vec2 u_resolution; | |
uniform vec2 u_mouse; | |
uniform float u_time; | |
#define TAU 6.283185307179586 | |
float random (vec2 st, float seed) { | |
return fract(sin(dot(st.xy, | |
vec2(12.9898,78.233)))* | |
43758.5453123 + seed * 69.420); | |
} | |
float random (vec2 st) { return random(st, 0.0); } | |
void main() | |
{ | |
vec2 st = gl_FragCoord.xy / u_resolution, | |
nc = st * 0.5 + 0.5; | |
vec2 ms = u_mouse / u_resolution; | |
int ndx = int((1.0 - st.y) * 16.0) * 16 + int((st.x) * 16.0); | |
st = floor(st * 128.0) / 128.0; | |
vec3 speedX = vec3(1.00, 2.00, 3.00), | |
speedY = vec3(1.33, 2.33, 3.33), | |
speedZ = vec3(1.66, 2.66, 3.66), | |
phaseX = vec3(1.00, 1.00, 1.00) * random(st, u_time * 0.02), | |
phaseY = vec3(2.00, 2.00, 2.00) * random(st, u_time * 0.02), | |
phaseZ = vec3(3.00, 3.00, 3.00) * random(st, u_time * 0.01), | |
amplX = vec3(0.70, 0.70, 0.70) * random(st, u_time * 0.02), | |
amplY = vec3(0.70, 0.70, 0.70) * random(st, u_time * 0.02), | |
amplZ = vec3(0.70, 0.70, 0.70) * random(st, u_time * 0.01), | |
valX = vec3( | |
abs(sin(u_time * speedX.x + phaseX.x)), | |
abs(sin(u_time * speedX.y + phaseX.y)), | |
abs(sin(u_time * speedX.z + phaseX.z)) | |
) * amplX, | |
valY = vec3( | |
abs(sin(u_time * speedY.x + phaseY.x)), | |
abs(sin(u_time * speedY.y + phaseY.y)), | |
abs(sin(u_time * speedY.z + phaseY.z)) | |
) * amplY, | |
valZ = vec3( | |
abs(sin(u_time * speedZ.x + phaseZ.x)), | |
abs(sin(u_time * speedZ.y + phaseZ.y)), | |
abs(sin(u_time * speedZ.z + phaseZ.z)) | |
) * amplZ, | |
map = vec3( | |
st.x * valX.x + st.y * valY.x + valZ.x * 0.5, | |
st.x * valX.y + st.y * valY.y + valZ.y * 0.5, | |
st.x * valX.z + st.y * valY.z + valZ.z * 0.5 | |
); | |
vec4 color = vec4(map, 1.0); | |
gl_FragColor = color; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment