Created
November 4, 2017 20:02
-
-
Save davidrusu/a005bc4d848b0b1ccc316d50d3792d1d 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
float angle(vec2 uv) { | |
float a = atan(uv.y / uv.x); | |
if (uv.x < 0.) { | |
a += PI; | |
} | |
if (uv.x > 0. && uv.y < 0.) { | |
a += PI2; | |
} | |
return a; | |
} | |
vec2 rad2vec(float r) { | |
return vec2(cos(r), sin(r)); | |
} | |
vec2 rotate(vec2 v, float r) { | |
//return vec2( v.x * cos(r) + v.y * sin(r), v.y * sin(r) - v.x * cos(r)); | |
return rotate(vec2(0.), v, r); | |
} | |
void main() { | |
vec3 c = black; | |
vec2 uv_ = uv(); | |
uv_ += rad2vec(noise(time * 0.1)) * 1.; | |
uv_ *= vec2(200., 200.) * 1.5; | |
uv_ += rad2vec(noise(uv_ * .5) * PI2) * 0.2; | |
uv_ += rad2vec(fbm(uv_, 2) * PI2) * 0.3; | |
float v = (cos(uv_.x) + pow(cos(uv_.x - PI/4.), 1.)); | |
v = v * .25 + 0.5; | |
v = v * pow(sin(uv_.y * .8 + (fbm(uv_.x * .5, 1) - .5) * 4.0 - abs(sin(uv_.x)) * .5) * 1., .4); | |
//v = pow(v, 2.); | |
v *= 1.; | |
c = v * vec3(.8, 0.15, .1); | |
gl_FragColor = vec4(c, 1.); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment