// skybox version of https://www.shadertoy.com/view/MllXz4 //noise function taken from https://www.shadertoy.com/view/XslGRr float hash( float n ){ return fract(sin(n)*43758.5453); } //this noise function was originally 3D noise, //but I am just setting z to 0 for the sake of simplicity here //also cause most effects only care about 2D noise float noise( vec2 uv ){ vec3 x = vec3(uv, 0); vec3 p = floor(x); vec3 f = fract(x); f = f*f*(3.0-2.0*f); float n = p.x + p.y*57.0 + 113.0*p.z; return mix(mix(mix( hash(n+0.0), hash(n+1.0),f.x), mix( hash(n+57.0), hash(n+58.0),f.x),f.y), mix(mix( hash(n+113.0), hash(n+114.0),f.x), mix( hash(n+170.0), hash(n+171.0),f.x),f.y),f.z); } float ring( float angle, float dist, float ANG, float THICKNESS, float POS, float SIZE ) { //angles between 4 and 15 are good //negative thickness makes it black, values around 0.02 are good float ZIGZAG = abs( mod( angle, ANG ) - ANG * 0.5 ) * SIZE; return ceil( dist - POS + ZIGZAG) - ceil( dist - (POS+THICKNESS) + ZIGZAG); } float burst( float angle, float dist, float ANG ) { float B = abs( mod( angle, ANG ) - ANG * 0.5 ); return B; } float lim( float IN, float amount ) { return IN * amount + (1.0 - amount); } float inv( float IN ) { return 1.0 - IN; } float ppp( float IN ) { return IN * IN * IN; } float dots( float angle, float dist, float ANG, float POS ) { return ppp(7.5*burst( angle, dist, ANG )/ANG) * ppp(inv(ANG*1.5*distance( dist, POS ))); } #ifdef GL_ES precision mediump float; #endif float normpdf(in float x, in float sigma) { return 0.39894*exp(-0.5*x*x/(sigma*sigma))/sigma; } vec4 myoutput( vec2 spherical ) { float dist = spherical.y; float angle = spherical.x; float TIMESCALE = 0.13; float T = iGlobalTime * TIMESCALE * 1.0; float n = noise( vec2( dist, T ) ); float slow_n = noise( vec2( dist, T * 0.02) ); float fast_n = noise( vec2( dist, T * 0.1) ); float vslow_n = noise( vec2( dist, T * 0.001) ); float vfast_n = noise( vec2( dist, T * 0.02) ); float t = noise( vec2( iGlobalTime, T ) ); float rand_r = noise( vec2( -T, T ) ); float slow_r = noise( vec2( -T * 0.5, 1.0 ) ); float vslow_r = noise( vec2( -T * 0.2, 1.0 ) ); float vvslow_r = noise( vec2( -T* 0.05, 1.0 ) ); float div = 7.0; float m = sin ( mod( angle, div )/(div*0.5) * 3.14 * 0.5 ); float a = mod( angle, 10.0 ) * noise( vec2( T, angle ) ); float TIME_MOD_SCALE = 0.5; float TIME_MOD = floor(0.5+sin( noise( vec2(-iGlobalTime + 10.0, 1.0 )) ))*0.5*TIMESCALE*TIME_MOD_SCALE; TIMESCALE = TIMESCALE * TIME_MOD; float GRANULARITY = 0.05; float GRAN_DIST_FALLOFF = 0.5; float GRAN_DIST_FALLOFF_MOD = tan(noise (vec2( 500.0, -T ) )); GRAN_DIST_FALLOFF = GRAN_DIST_FALLOFF + GRAN_DIST_FALLOFF_MOD * 0.5; float Gr = (GRANULARITY-(dist * GRANULARITY * GRAN_DIST_FALLOFF)) * 0.1; float Gg = (GRANULARITY-(dist * GRANULARITY * GRAN_DIST_FALLOFF)) * 0.005; float Gb = (GRANULARITY-(dist * GRANULARITY * GRAN_DIST_FALLOFF)) * 0.01; float Gsign = clamp( sign( noise (vec2( T * 0.22, -T * 1.5 )) -0.5 ), -1.0, 0.0 ); float rn = 360.0 / (ceil( noise(vec2( sin(T*0.1), 0.5 ) ) * 50.0) * 2.0 ); //randomly some divisor of 360 float rd1 = ceil( noise(vec2( tan(T/10.0), 1.0 ) ) * 2.0 ); //randomly either 1 or 2 float rd2 = ceil( noise(vec2( sin(T/10.0), 1.0 ) ) * 2.0 ); //randomly either 1 or 2 float rd3 = ceil( noise(vec2( cos(T/10.0), 1.0 ) ) * 2.0 ); //randomly either 1 or 2 float rd4 = ceil( noise(vec2( tan(T*0.0075+99.0), 1.0 ) ) * 1.2 ); //randomly either 1 or 2 float rd5 = ceil( noise(vec2( tan(T*0.008+124.0), 1.0 ) ) * 1.5 ); //randomly either 1 or 2 float rd6 = ceil( noise(vec2( tan(T*0.007+24.0), 1.0 ) ) * 1.7 ); //randomly either 1 or 2 float rd7 = ceil( noise(vec2( tan(T*0.005), 1.0 ) ) * 1.4 ); //randomly either 1 or 2 float exp4 = ceil( noise(vec2( tan(T*0.5), 1.0 ) ) * 2.0 ) * rd1; float coarse3 = ceil( noise(vec2( cos(T), 1.0 ) ) * 3.0 ); float coarse10 = ceil( noise(vec2( cos(T), 1.0 ) ) * 10.0 ); vec3 RING1 = rd2 * 0.5 * ring( angle, dist,6.0, 0.02, n, 0.01) * vec3( 1.0, 1.0, 1.0 ) * floor( n + 0.5 ); // PINK ZIG ZAG vec3 RING2 = ring( angle, dist,10.0, 0.01, n/2.0, 0.01) * vec3( 1.0, 1.0, 1.0 ) * ceil( n - 0.3 );// PINK ZIG ZAG HIGH vec3 RING3 = ring( angle+(vslow_n*200.0*coarse3)*(2.0+n), dist,90.0*rd1/rd4, (0.02 + rand_r*0.01 + ppp(slow_r)*0.011)*ppp(rd4), n, 0.01) * vec3( 1.0, 1.0, 1.0 ) * 0.5; // SPIRAL FLickers too much vec3 RING4 = ring( angle-iGlobalTime*(5.0*n), dist,10.0, 0.05, n, 0.01) * vec3( sin(T), cos(T), 0.1 ) * 0.5; // LARGE SLOW RED ZIG ZAG NICE vec3 RING5 = ring( angle, dist,30.0, n*20.0, n+0.3, 0.01) * vec3( 1.0, 1.0, 1.0 ) * 0.05 + (dist)*0.05; // COARSE AND HARD TO LOOK AT - HIDE ME vec3 BURST1 = burst( angle, dist, rn * rd1 ) * vec3( 1.0, 1.0, 1.0 ) * 0.03 * (1.0 - dist); // FLICKERS HIDE ME vec3 RING6 = max(ring( angle-(vslow_n*200.0*coarse3)*(2.0+vslow_n), dist,45.0*rd1, 0.3, n, 0.01),0.0) * vec3( sin(T), tan(T) * 0.05, rand_r ) * (rd7 - 1.0) * inv(dist) * 0.5; // NICE DANCING SPIRALS BUT POPS OUT IN YELLOW vec3 DOTS1 = max(ceil(dots( angle + T*30.0, dist, 10.0, 0.25 + rand_r*0.1 )-24.5 * (1.0+rand_r)),0.0) * vec3( rand_r, inv(rand_r), n ) * 0.15; vec3 DOTS2 = max(ceil(dots( angle - T*35.0, dist, 10.0, 0.3 + rand_r*0.2 )-16.4 * (2.0-rand_r)),0.0) * vec3( n, rand_r, inv(rand_r) ) * 0.15; vec3 DOTS3 = clamp( 1.0 * dots( angle + T * 45.0, dist, 15.0, 0.9 ), 0.0, 1.0) * vec3( 1.0, 1.0, 1.0 ) * 0.05; vec3 DOTS4 = clamp( 1.0 * dots( angle - T * 45.0, dist, 15.0, 0.82 ), 0.0, 1.0) * vec3( 1.0, 1.0, 1.0 ) * 0.025; vec3 RING = RING1 + RING2 +RING4 + DOTS1 + DOTS2+ DOTS3+RING3 +RING6 + DOTS4; float r = RING.b + max((1.0 - dist * 2.0),-0.5) + noise( vec2( dist * Gr * sin( noise(vec2( iGlobalTime * 8.0 * TIMESCALE, -iGlobalTime )) ), dist ) );;//floor(n*2.0) * a; float g = RING.g + max((1.0 - dist * 3.5),-1.5) + noise( vec2( dist * Gg * TIMESCALE * cos( noise(vec2( iGlobalTime * 12.0 * TIMESCALE, -iGlobalTime )) ), dist ) );;//ceil(n/3.0 - 0.1) - a; g = g * 0.001; float b = RING.r + max((1.0 - dist * 2.5),-1.0) + noise( vec2( dist * Gb * tan( noise(vec2( iGlobalTime * 1.0 * TIMESCALE, -iGlobalTime )) ), dist ) );;//ceil(n/3.0 - 0.2) - a; vec3 boost = vec3( 1,0,1); return vec4(r*boost.r,g*boost.g,b*boost.b,1.0) * mix(dist,1.0,0.7); float over = DOTS3.x + DOTS4.x; } vec3 getOutput(vec3 d) { vec2 spherical; spherical.x = degrees(atan(d.x, d.z)); spherical.y = (acos(d.y) + 1.0) / 4.0; return myoutput(spherical).rgb; } mat3 rot(vec3 a, float b) { a = normalize(a); float s = sin(b); float c = cos(b); float d = 1.0 - c; return mat3(d * a.x * a.x + c, d * a.x * a.y - a.z * s, d * a.z * a.x + a.y * s, d * a.x * a.y + a.z * s, d * a.y * a.y + c, d * a.y * a.z - a.x * s, d * a.z * a.x - a.y * s, d * a.y * a.z + a.x * s, d * a.z * a.z + c); } float e = 2.3, p = atan(1.) * 4.; vec3 getPixelDirection(in vec2 fragCoord) { vec2 R = iResolution.xy, u = fragCoord / R; vec4 m = iMouse / R.xyxx; mat3 rmx = rot(vec3(0, 1, 0), clamp(-m.w * R.x, 0., 1.) * 3.14 / 10. + m.x * p * 2.); rmx *= rot(cross(vec3(0, 1, 0), vec3(0, 0, 1) * rmx), m.y * p - p / 2.); vec3 d = normalize(vec3((u * 2. - 1.) * vec2(iResolution.x / iResolution.y, 1), 1)) * rmx; return d; } void mainImage( out vec4 fragColor, in vec2 fragCoord ) { vec3 d = getPixelDirection(fragCoord); fragColor = vec4(getOutput(d), 1.0); } vec3 getSkyboxColor() { return getOutput(normalize(_normal)); }