| 1 |
// Taken from https://www.shadertoy.com/view/4ttGWM |
| 2 |
|
| 3 |
// I started working a bit on the colors of Remix 2, ended up with something like this. :) |
| 4 |
// Remix 2 here: https://www.shadertoy.com/view/MtcGD7 |
| 5 |
// Remix 1 here: https://www.shadertoy.com/view/llc3DM |
| 6 |
// Original here: https://www.shadertoy.com/view/XsXXRN |
| 7 |
|
| 8 |
float rand(vec2 n) { |
| 9 |
return fract(sin(cos(dot(n, vec2(12.9898,12.1414)))) * 83758.5453); |
| 10 |
} |
| 11 |
|
| 12 |
float noise(vec2 n) { |
| 13 |
const vec2 d = vec2(0.0, 1.0); |
| 14 |
vec2 b = floor(n), f = smoothstep(vec2(0.0), vec2(1.0), fract(n)); |
| 15 |
return mix(mix(rand(b), rand(b + d.yx), f.x), mix(rand(b + d.xy), rand(b + d.yy), f.x), f.y); |
| 16 |
} |
| 17 |
|
| 18 |
float fbm(vec2 n) { |
| 19 |
float total = 0.0, amplitude = 1.0; |
| 20 |
for (int i = 0; i <5; i++) { |
| 21 |
total += noise(n) * amplitude; |
| 22 |
n += n*1.7; |
| 23 |
amplitude *= 0.47; |
| 24 |
} |
| 25 |
return total; |
| 26 |
} |
| 27 |
|
| 28 |
void mainImage( out vec4 fragColor, in vec2 fragCoord ) { |
| 29 |
|
| 30 |
const vec3 c1 = vec3(0.5, 0.0, 0.1); |
| 31 |
const vec3 c2 = vec3(0.9, 0.1, 0.0); |
| 32 |
const vec3 c3 = vec3(0.2, 0.1, 0.7); |
| 33 |
const vec3 c4 = vec3(1.0, 0.9, 0.1); |
| 34 |
const vec3 c5 = vec3(0.1); |
| 35 |
const vec3 c6 = vec3(0.9); |
| 36 |
|
| 37 |
vec2 speed = vec2(0.1, 0.9); |
| 38 |
float shift = 1.327+sin(iTime*2.0)/2.4; |
| 39 |
float alpha = 1.0; |
| 40 |
|
| 41 |
float dist = 3.5-sin(iTime*0.4)/1.89; |
| 42 |
|
| 43 |
vec2 uv = fragCoord.xy / iResolution.xy; |
| 44 |
vec2 p = fragCoord.xy * dist / iResolution.xx; |
| 45 |
p += sin(p.yx*4.0+vec2(.2,-.3)*iTime)*0.04; |
| 46 |
p += sin(p.yx*8.0+vec2(.6,+.1)*iTime)*0.01; |
| 47 |
|
| 48 |
p.x -= iTime/1.1; |
| 49 |
float q = fbm(p - iTime * 0.3+1.0*sin(iTime+0.5)/2.0); |
| 50 |
float qb = fbm(p - iTime * 0.4+0.1*cos(iTime)/2.0); |
| 51 |
float q2 = fbm(p - iTime * 0.44 - 5.0*cos(iTime)/2.0) - 6.0; |
| 52 |
float q3 = fbm(p - iTime * 0.9 - 10.0*cos(iTime)/15.0)-4.0; |
| 53 |
float q4 = fbm(p - iTime * 1.4 - 20.0*sin(iTime)/14.0)+2.0; |
| 54 |
q = (q + qb - .4 * q2 -2.0*q3 + .6*q4)/3.8; |
| 55 |
vec2 r = vec2(fbm(p + q /2.0 + iTime * speed.x - p.x - p.y), fbm(p + q - iTime * speed.y)); |
| 56 |
vec3 c = mix(c1, c2, fbm(p + r)) + mix(c3, c4, r.x) - mix(c5, c6, r.y); |
| 57 |
vec3 color = vec3(1.0/(pow(c+1.61,vec3(4.0))) * cos(shift * fragCoord.y / iResolution.y)); |
| 58 |
|
| 59 |
color=vec3(1.0,.2,.05)/(pow((r.y+r.y)* max(.0,p.y)+0.1, 4.0));; |
| 60 |
color += (texture(iChannel0,uv*0.6+vec2(.5,.1)).xyz*0.01*pow((r.y+r.y)*.65,5.0)+0.055)*mix( vec3(.9,.4,.3),vec3(.7,.5,.2), uv.y); |
| 61 |
color = color/(1.0+max(vec3(0),color)); |
| 62 |
fragColor = vec4(color.x, color.y, color.z, alpha); |
| 63 |
} |