$ glslc shadertoy-Xds3zN.frag -o shadertoy-Xds3zN.spv
$ spirv-cross --es shadertoy-Xds3zN.spv --output shadertoy-Xds3zN.decomp.frag
$ spirv-opt --strip-debug -o shadertoy-Xds3zN.opt.spv
$ spirv-cross --es shadertoy-Xds3zN.opt.spv --output shadertoy-Xds3zN.opt.frag
shadertoy-Xds3zN.frag shadertoy-Xds3zN.decomp.frag shadertoy-Xds3zN.opt.frag
#version 310 es
precision highp float;
precision highp int;
precision mediump sampler3D;
struct Channel
{
    vec3  resolution;
    float time;
};
uniform block1 {
    vec3      iResolution;
    float     iTime;
    float     iChannelTime[4];
    vec4      iMouse;
    vec4      iDate;
    float     iSampleRate;
    vec3      iChannelResolution[4];
    int       iFrame;
    float     iTimeDelta;
    float     iFrameRate;
    Channel iChannel[4];
};
uniform sampler2D iChannel0;
uniform sampler2D iChannel1;
uniform sampler2D iChannel2;
uniform sampler2D iChannel3;
void mainImage( out vec4 c,  in vec2 f );
// The MIT License
// Copyright © 2013 Inigo Quilez
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    

// A list of useful distance function to simple primitives, and an example on how to 
// do some interesting boolean operations, repetition and displacement.
//
// More info here: http://www.iquilezles.org/www/articles/distfunctions/distfunctions.htm


#define AA 1   // make this 1 is your machine is too slow

//------------------------------------------------------------------

float sdPlane( vec3 p )
{
	return p.y;
}

float sdSphere( vec3 p, float s )
{
    return length(p)-s;
}

float sdBox( vec3 p, vec3 b )
{
    vec3 d = abs(p) - b;
    return min(max(d.x,max(d.y,d.z)),0.0) + length(max(d,0.0));
}

float sdEllipsoid( in vec3 p, in vec3 r )
{
    return (length( p/r ) - 1.0) * min(min(r.x,r.y),r.z);
}

float udRoundBox( vec3 p, vec3 b, float r )
{
    return length(max(abs(p)-b,0.0))-r;
}

float sdTorus( vec3 p, vec2 t )
{
    return length( vec2(length(p.xz)-t.x,p.y) )-t.y;
}

float sdHexPrism( vec3 p, vec2 h )
{
    vec3 q = abs(p);
#if 0
    return max(q.z-h.y,max((q.x*0.866025+q.y*0.5),q.y)-h.x);
#else
    float d1 = q.z-h.y;
    float d2 = max((q.x*0.866025+q.y*0.5),q.y)-h.x;
    return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
#endif
}

float sdCapsule( vec3 p, vec3 a, vec3 b, float r )
{
	vec3 pa = p-a, ba = b-a;
	float h = clamp( dot(pa,ba)/dot(ba,ba), 0.0, 1.0 );
	return length( pa - ba*h ) - r;
}

float sdEquilateralTriangle(  in vec2 p )
{
    const float k = sqrt(3.0);
    p.x = abs(p.x) - 1.0;
    p.y = p.y + 1.0/k;
    if( p.x + k*p.y > 0.0 ) p = vec2( p.x - k*p.y, -k*p.x - p.y )/2.0;
    p.x += 2.0 - 2.0*clamp( (p.x+2.0)/2.0, 0.0, 1.0 );
    return -length(p)*sign(p.y);
}

float sdTriPrism( vec3 p, vec2 h )
{
    vec3 q = abs(p);
    float d1 = q.z-h.y;
#if 1
    // distance bound
    float d2 = max(q.x*0.866025+p.y*0.5,-p.y)-h.x*0.5;
#else
    // correct distance
    h.x *= 0.866025;
    float d2 = sdEquilateralTriangle(p.xy/h.x)*h.x;
#endif
    return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
}

float sdCylinder( vec3 p, vec2 h )
{
  vec2 d = abs(vec2(length(p.xz),p.y)) - h;
  return min(max(d.x,d.y),0.0) + length(max(d,0.0));
}

float sdCone( in vec3 p, in vec3 c )
{
    vec2 q = vec2( length(p.xz), p.y );
    float d1 = -q.y-c.z;
    float d2 = max( dot(q,c.xy), q.y);
    return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
}

float sdConeSection( in vec3 p, in float h, in float r1, in float r2 )
{
    float d1 = -p.y - h;
    float q = p.y - h;
    float si = 0.5*(r1-r2)/h;
    float d2 = max( sqrt( dot(p.xz,p.xz)*(1.0-si*si)) + q*si - r2, q );
    return length(max(vec2(d1,d2),0.0)) + min(max(d1,d2), 0.);
}

float sdPryamid4(vec3 p, vec3 h ) // h = { cos a, sin a, height }
{
    // Tetrahedron = Octahedron - Cube
    float box = sdBox( p - vec3(0,-2.0*h.z,0), vec3(2.0*h.z) );
 
    float d = 0.0;
    d = max( d, abs( dot(p, vec3( -h.x, h.y, 0 )) ));
    d = max( d, abs( dot(p, vec3(  h.x, h.y, 0 )) ));
    d = max( d, abs( dot(p, vec3(  0, h.y, h.x )) ));
    d = max( d, abs( dot(p, vec3(  0, h.y,-h.x )) ));
    float octa = d - h.z;
    return max(-box,octa); // Subtraction
 }

float length2( vec2 p )
{
	return sqrt( p.x*p.x + p.y*p.y );
}

float length6( vec2 p )
{
	p = p*p*p; p = p*p;
	return pow( p.x + p.y, 1.0/6.0 );
}

float length8( vec2 p )
{
	p = p*p; p = p*p; p = p*p;
	return pow( p.x + p.y, 1.0/8.0 );
}

float sdTorus82( vec3 p, vec2 t )
{
    vec2 q = vec2(length2(p.xz)-t.x,p.y);
    return length8(q)-t.y;
}

float sdTorus88( vec3 p, vec2 t )
{
    vec2 q = vec2(length8(p.xz)-t.x,p.y);
    return length8(q)-t.y;
}

float sdCylinder6( vec3 p, vec2 h )
{
    return max( length6(p.xz)-h.x, abs(p.y)-h.y );
}

//------------------------------------------------------------------

float opS( float d1, float d2 )
{
    return max(-d2,d1);
}

vec2 opU( vec2 d1, vec2 d2 )
{
	return (d1.x0.0 ) tmax = min( tmax, tp1 );
    float tp2 = (1.6-ro.y)/rd.y; if( tp2>0.0 ) { if( ro.y>1.6 ) tmin = max( tmin, tp2 );
                                                 else           tmax = min( tmax, tp2 ); }
#endif
    
    float t = tmin;
    float m = -1.0;
    for( int i=0; i<64; i++ )
    {
	    float precis = 0.0005*t;
	    vec2 res = map( ro+rd*t );
        if( res.xtmax ) break;
        t += res.x;
	    m = res.y;
    }

    if( t>tmax ) m=-1.0;
    return vec2( t, m );
}


float softshadow( in vec3 ro, in vec3 rd, in float mint, in float tmax )
{
	float res = 1.0;
    float t = mint;
    for( int i=0; i<16; i++ )
    {
		float h = map( ro + rd*t ).x;
        res = min( res, 8.0*h/t );
        t += clamp( h, 0.02, 0.10 );
        if( h<0.001 || t>tmax ) break;
    }
    return clamp( res, 0.0, 1.0 );
}

vec3 calcNormal( in vec3 pos )
{
    vec2 e = vec2(1.0,-1.0)*0.5773*0.0005;
    return normalize( e.xyy*map( pos + e.xyy ).x + 
					  e.yyx*map( pos + e.yyx ).x + 
					  e.yxy*map( pos + e.yxy ).x + 
					  e.xxx*map( pos + e.xxx ).x );
    /*
	vec3 eps = vec3( 0.0005, 0.0, 0.0 );
	vec3 nor = vec3(
	    map(pos+eps.xyy).x - map(pos-eps.xyy).x,
	    map(pos+eps.yxy).x - map(pos-eps.yxy).x,
	    map(pos+eps.yyx).x - map(pos-eps.yyx).x );
	return normalize(nor);
	*/
}

float calcAO( in vec3 pos, in vec3 nor )
{
	float occ = 0.0;
    float sca = 1.0;
    for( int i=0; i<5; i++ )
    {
        float hr = 0.01 + 0.12*float(i)/4.0;
        vec3 aopos =  nor * hr + pos;
        float dd = map( aopos ).x;
        occ += -(dd-hr)*sca;
        sca *= 0.95;
    }
    return clamp( 1.0 - 3.0*occ, 0.0, 1.0 );    
}

vec3 render( in vec3 ro, in vec3 rd )
{ 
    vec3 col = vec3(0.7, 0.9, 1.0) +rd.y*0.8;
    vec2 res = castRay(ro,rd);
    float t = res.x;
	float m = res.y;
    if( m>-0.5 )
    {
        vec3 pos = ro + t*rd;
        vec3 nor = calcNormal( pos );
        vec3 ref = reflect( rd, nor );
        
        // material        
		col = 0.45 + 0.35*sin( vec3(0.05,0.08,0.10)*(m-1.0) );
        if( m<1.5 )
        {
            
            float f = mod( floor(5.0*pos.z) + floor(5.0*pos.x), 2.0);
            col = 0.3 + 0.1*f*vec3(1.0);
        }

        // lighitng        
        float occ = calcAO( pos, nor );
		vec3  lig = normalize( vec3(-0.4, 0.7, -0.6) );
		float amb = clamp( 0.5+0.5*nor.y, 0.0, 1.0 );
        float dif = clamp( dot( nor, lig ), 0.0, 1.0 );
        float bac = clamp( dot( nor, normalize(vec3(-lig.x,0.0,-lig.z))), 0.0, 1.0 )*clamp( 1.0-pos.y,0.0,1.0);
        float dom = smoothstep( -0.1, 0.1, ref.y );
        float fre = pow( clamp(1.0+dot(nor,rd),0.0,1.0), 2.0 );
		float spe = pow(clamp( dot( ref, lig ), 0.0, 1.0 ),16.0);
        
        dif *= softshadow( pos, lig, 0.02, 2.5 );
        dom *= softshadow( pos, ref, 0.02, 2.5 );

		vec3 lin = vec3(0.0);
        lin += 1.30*dif*vec3(1.00,0.80,0.55);
		lin += 2.00*spe*vec3(1.00,0.90,0.70)*dif;
        lin += 0.40*amb*vec3(0.40,0.60,1.00)*occ;
        lin += 0.50*dom*vec3(0.40,0.60,1.00)*occ;
        lin += 0.50*bac*vec3(0.25,0.25,0.25)*occ;
        lin += 0.25*fre*vec3(1.00,1.00,1.00)*occ;
		col = col*lin;

    	col = mix( col, vec3(0.8,0.9,1.0), 1.0-exp( -0.0002*t*t*t ) );
    }

	return vec3( clamp(col,0.0,1.0) );
}

mat3 setCamera( in vec3 ro, in vec3 ta, float cr )
{
	vec3 cw = normalize(ta-ro);
	vec3 cp = vec3(sin(cr), cos(cr),0.0);
	vec3 cu = normalize( cross(cw,cp) );
	vec3 cv = normalize( cross(cu,cw) );
    return mat3( cu, cv, cw );
}

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    vec2 mo = iMouse.xy/iResolution.xy;
	float time = 15.0 + iTime;

    
    vec3 tot = vec3(0.0);
#if AA>1
    for( int m=0; m1
    }
    tot /= float(AA*AA);
#endif

    
    fragColor = vec4( tot, 1.0 );
}
layout(location=0) out vec4 outColor;

void main( void ){vec4 color = vec4(0.0,0.0,0.0,1.0);mainImage( color, gl_FragCoord.xy );color.w = 1.0;outColor = color;}
#version 310 es
precision mediump float;
precision highp int;

struct Channel
{
    highp vec3 resolution;
    highp float time;
};

layout(std140) uniform block1
{
    highp vec3 iResolution;
    highp float iTime;
    highp float iChannelTime[4];
    highp vec4 iMouse;
    highp vec4 iDate;
    highp float iSampleRate;
    highp vec3 iChannelResolution[4];
    int iFrame;
    highp float iTimeDelta;
    highp float iFrameRate;
    Channel iChannel[4];
} _1518;

uniform mediump sampler2D iChannel0;
uniform mediump sampler2D iChannel1;
uniform mediump sampler2D iChannel2;
uniform mediump sampler2D iChannel3;

layout(location = 0) out highp vec4 outColor;

highp mat3 setCamera(highp vec3 ro, highp vec3 ta, highp float cr)
{
    highp vec3 cw = normalize(ta - ro);
    highp vec3 cp = vec3(sin(cr), cos(cr), 0.0);
    highp vec3 cu = normalize(cross(cw, cp));
    highp vec3 cv = normalize(cross(cu, cw));
    return mat3(vec3(cu), vec3(cv), vec3(cw));
}

highp float sdPlane(highp vec3 p)
{
    return p.y;
}

highp float sdSphere(highp vec3 p, highp float s)
{
    return length(p) - s;
}

highp vec2 opU(highp vec2 d1, highp vec2 d2)
{
    return mix(d2, d1, bvec2(d1.x < d2.x));
}

highp float sdBox(highp vec3 p, highp vec3 b)
{
    highp vec3 d = abs(p) - b;
    return min(max(d.x, max(d.y, d.z)), 0.0) + length(max(d, vec3(0.0)));
}

highp float udRoundBox(highp vec3 p, highp vec3 b, highp float r)
{
    return length(max(abs(p) - b, vec3(0.0))) - r;
}

highp float sdTorus(highp vec3 p, highp vec2 t)
{
    return length(vec2(length(p.xz) - t.x, p.y)) - t.y;
}

highp float sdCapsule(highp vec3 p, highp vec3 a, highp vec3 b, highp float r)
{
    highp vec3 pa = p - a;
    highp vec3 ba = b - a;
    highp float h = clamp(dot(pa, ba) / dot(ba, ba), 0.0, 1.0);
    return length(pa - (ba * h)) - r;
}

highp float sdTriPrism(highp vec3 p, highp vec2 h)
{
    highp vec3 q = abs(p);
    highp float d1 = q.z - h.y;
    highp float d2 = max((q.x * 0.86602497100830078125) + (p.y * 0.5), -p.y) - (h.x * 0.5);
    return length(max(vec2(d1, d2), vec2(0.0))) + min(max(d1, d2), 0.0);
}

highp float sdCylinder(highp vec3 p, highp vec2 h)
{
    highp vec2 d = abs(vec2(length(p.xz), p.y)) - h;
    return min(max(d.x, d.y), 0.0) + length(max(d, vec2(0.0)));
}

highp float sdCone(highp vec3 p, highp vec3 c)
{
    highp vec2 q = vec2(length(p.xz), p.y);
    highp float d1 = (-q.y) - c.z;
    highp float d2 = max(dot(q, c.xy), q.y);
    return length(max(vec2(d1, d2), vec2(0.0))) + min(max(d1, d2), 0.0);
}

highp float length2(highp vec2 p)
{
    return sqrt((p.x * p.x) + (p.y * p.y));
}

highp float length8(inout highp vec2 p)
{
    p *= p;
    p *= p;
    p *= p;
    return pow(p.x + p.y, 0.125);
}

highp float sdTorus82(highp vec3 p, highp vec2 t)
{
    highp vec2 param = p.xz;
    highp vec2 q = vec2(length2(param) - t.x, p.y);
    highp vec2 param_1 = q;
    highp float _580 = length8(param_1);
    return _580 - t.y;
}

highp float sdTorus88(highp vec3 p, highp vec2 t)
{
    highp vec2 param = p.xz;
    highp float _590 = length8(param);
    highp vec2 q = vec2(_590 - t.x, p.y);
    highp vec2 param_1 = q;
    highp float _599 = length8(param_1);
    return _599 - t.y;
}

highp float length6(inout highp vec2 p)
{
    p = (p * p) * p;
    p *= p;
    return pow(p.x + p.y, 0.16666667163372039794921875);
}

highp float sdCylinder6(highp vec3 p, highp vec2 h)
{
    highp vec2 param = p.xz;
    highp float _608 = length6(param);
    return max(_608 - h.x, abs(p.y) - h.y);
}

highp float sdHexPrism(highp vec3 p, highp vec2 h)
{
    highp vec3 q = abs(p);
    highp float d1 = q.z - h.y;
    highp float d2 = max((q.x * 0.86602497100830078125) + (q.y * 0.5), q.y) - h.x;
    return length(max(vec2(d1, d2), vec2(0.0))) + min(max(d1, d2), 0.0);
}

highp float sdPryamid4(highp vec3 p, highp vec3 h)
{
    highp vec3 param = p - vec3(0.0, (-2.0) * h.z, 0.0);
    highp vec3 param_1 = vec3(2.0 * h.z);
    highp float box = sdBox(param, param_1);
    highp float d = 0.0;
    d = max(d, abs(dot(p, vec3(-h.x, h.y, 0.0))));
    d = max(d, abs(dot(p, vec3(h.x, h.y, 0.0))));
    d = max(d, abs(dot(p, vec3(0.0, h.y, h.x))));
    d = max(d, abs(dot(p, vec3(0.0, h.y, -h.x))));
    highp float octa = d - h.z;
    return max(-box, octa);
}

highp float opS(highp float d1, highp float d2)
{
    return max(-d2, d1);
}

highp vec3 opRep(highp vec3 p, highp vec3 c)
{
    return mod(p, c) - (c * 0.5);
}

highp vec3 opTwist(highp vec3 p)
{
    highp float c = cos((10.0 * p.y) + 10.0);
    highp float s = sin((10.0 * p.y) + 10.0);
    highp mat2 m = mat2(vec2(c, -s), vec2(s, c));
    return vec3(m * p.xz, p.y);
}

highp float sdConeSection(highp vec3 p, highp float h, highp float r1, highp float r2)
{
    highp float d1 = (-p.y) - h;
    highp float q = p.y - h;
    highp float si = (0.5 * (r1 - r2)) / h;
    highp float d2 = max((sqrt(dot(p.xz, p.xz) * (1.0 - (si * si))) + (q * si)) - r2, q);
    return length(max(vec2(d1, d2), vec2(0.0))) + min(max(d1, d2), 0.0);
}

highp float sdEllipsoid(highp vec3 p, highp vec3 r)
{
    return (length(p / r) - 1.0) * min(min(r.x, r.y), r.z);
}

highp vec2 map(highp vec3 pos)
{
    highp vec3 param = pos;
    highp vec3 param_1 = pos - vec3(0.0, 0.25, 0.0);
    highp float param_2 = 0.25;
    highp vec2 param_3 = vec2(sdPlane(param), 1.0);
    highp vec2 param_4 = vec2(sdSphere(param_1, param_2), 46.90000152587890625);
    highp vec2 res = opU(param_3, param_4);
    highp vec3 param_5 = pos - vec3(1.0, 0.25, 0.0);
    highp vec3 param_6 = vec3(0.25);
    highp vec2 param_7 = res;
    highp vec2 param_8 = vec2(sdBox(param_5, param_6), 3.0);
    res = opU(param_7, param_8);
    highp vec3 param_9 = pos - vec3(1.0, 0.25, 1.0);
    highp vec3 param_10 = vec3(0.1500000059604644775390625);
    highp float param_11 = 0.100000001490116119384765625;
    highp vec2 param_12 = res;
    highp vec2 param_13 = vec2(udRoundBox(param_9, param_10, param_11), 41.0);
    res = opU(param_12, param_13);
    highp vec3 param_14 = pos - vec3(0.0, 0.25, 1.0);
    highp vec2 param_15 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 param_16 = res;
    highp vec2 param_17 = vec2(sdTorus(param_14, param_15), 25.0);
    res = opU(param_16, param_17);
    highp vec3 param_18 = pos;
    highp vec3 param_19 = vec3(-1.2999999523162841796875, 0.100000001490116119384765625, -0.100000001490116119384765625);
    highp vec3 param_20 = vec3(-0.800000011920928955078125, 0.5, 0.20000000298023223876953125);
    highp float param_21 = 0.100000001490116119384765625;
    highp vec2 param_22 = res;
    highp vec2 param_23 = vec2(sdCapsule(param_18, param_19, param_20, param_21), 31.8999996185302734375);
    res = opU(param_22, param_23);
    highp vec3 param_24 = pos - vec3(-1.0, 0.25, -1.0);
    highp vec2 param_25 = vec2(0.25, 0.0500000007450580596923828125);
    highp vec2 param_26 = res;
    highp vec2 param_27 = vec2(sdTriPrism(param_24, param_25), 43.5);
    res = opU(param_26, param_27);
    highp vec3 param_28 = pos - vec3(1.0, 0.300000011920928955078125, -1.0);
    highp vec2 param_29 = vec2(0.100000001490116119384765625, 0.20000000298023223876953125);
    highp vec2 param_30 = res;
    highp vec2 param_31 = vec2(sdCylinder(param_28, param_29), 8.0);
    res = opU(param_30, param_31);
    highp vec3 param_32 = pos - vec3(0.0, 0.5, -1.0);
    highp vec3 param_33 = vec3(0.800000011920928955078125, 0.60000002384185791015625, 0.300000011920928955078125);
    highp vec2 param_34 = res;
    highp vec2 param_35 = vec2(sdCone(param_32, param_33), 55.0);
    res = opU(param_34, param_35);
    highp vec3 param_36 = pos - vec3(0.0, 0.25, 2.0);
    highp vec2 param_37 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 param_38 = res;
    highp vec2 param_39 = vec2(sdTorus82(param_36, param_37), 50.0);
    res = opU(param_38, param_39);
    highp vec3 param_40 = pos - vec3(-1.0, 0.25, 2.0);
    highp vec2 param_41 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 param_42 = res;
    highp vec2 param_43 = vec2(sdTorus88(param_40, param_41), 43.0);
    res = opU(param_42, param_43);
    highp vec3 param_44 = pos - vec3(1.0, 0.300000011920928955078125, 2.0);
    highp vec2 param_45 = vec2(0.100000001490116119384765625, 0.20000000298023223876953125);
    highp vec2 param_46 = res;
    highp vec2 param_47 = vec2(sdCylinder6(param_44, param_45), 12.0);
    res = opU(param_46, param_47);
    highp vec3 param_48 = pos - vec3(-1.0, 0.20000000298023223876953125, 1.0);
    highp vec2 param_49 = vec2(0.25, 0.0500000007450580596923828125);
    highp vec2 param_50 = res;
    highp vec2 param_51 = vec2(sdHexPrism(param_48, param_49), 17.0);
    res = opU(param_50, param_51);
    highp vec3 param_52 = pos - vec3(-1.0, 0.1500000059604644775390625, -2.0);
    highp vec3 param_53 = vec3(0.800000011920928955078125, 0.60000002384185791015625, 0.25);
    highp vec2 param_54 = res;
    highp vec2 param_55 = vec2(sdPryamid4(param_52, param_53), 37.0);
    res = opU(param_54, param_55);
    highp vec3 param_56 = pos - vec3(-2.0, 0.20000000298023223876953125, 1.0);
    highp vec3 param_57 = vec3(0.1500000059604644775390625);
    highp float param_58 = 0.0500000007450580596923828125;
    highp vec3 param_59 = pos - vec3(-2.0, 0.20000000298023223876953125, 1.0);
    highp float param_60 = 0.25;
    highp float param_61 = udRoundBox(param_56, param_57, param_58);
    highp float param_62 = sdSphere(param_59, param_60);
    highp vec2 param_63 = res;
    highp vec2 param_64 = vec2(opS(param_61, param_62), 13.0);
    res = opU(param_63, param_64);
    highp vec3 param_65 = pos - vec3(-2.0, 0.20000000298023223876953125, 0.0);
    highp vec2 param_66 = vec2(0.20000000298023223876953125, 0.100000001490116119384765625);
    highp vec3 param_67 = vec3(atan(pos.x + 2.0, pos.z) / 6.283100128173828125, pos.y, 0.0199999995529651641845703125 + (0.5 * length(pos - vec3(-2.0, 0.20000000298023223876953125, 0.0))));
    highp vec3 param_68 = vec3(0.0500000007450580596923828125, 1.0, 0.0500000007450580596923828125);
    highp vec3 param_69 = opRep(param_67, param_68);
    highp vec2 param_70 = vec2(0.0199999995529651641845703125, 0.60000002384185791015625);
    highp float param_71 = sdTorus82(param_65, param_66);
    highp float param_72 = sdCylinder(param_69, param_70);
    highp vec2 param_73 = res;
    highp vec2 param_74 = vec2(opS(param_71, param_72), 51.0);
    res = opU(param_73, param_74);
    highp vec3 param_75 = pos - vec3(-2.0, 0.25, -1.0);
    highp float param_76 = 0.20000000298023223876953125;
    highp vec2 param_77 = res;
    highp vec2 param_78 = vec2((0.5 * sdSphere(param_75, param_76)) + (((0.02999999932944774627685546875 * sin(50.0 * pos.x)) * sin(50.0 * pos.y)) * sin(50.0 * pos.z)), 65.0);
    res = opU(param_77, param_78);
    highp vec3 param_79 = pos - vec3(-2.0, 0.25, 2.0);
    highp vec3 param_80 = opTwist(param_79);
    highp vec2 param_81 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 param_82 = res;
    highp vec2 param_83 = vec2(0.5 * sdTorus(param_80, param_81), 46.700000762939453125);
    res = opU(param_82, param_83);
    highp vec3 param_84 = pos - vec3(0.0, 0.3499999940395355224609375, -2.0);
    highp float param_85 = 0.1500000059604644775390625;
    highp float param_86 = 0.20000000298023223876953125;
    highp float param_87 = 0.100000001490116119384765625;
    highp vec2 param_88 = res;
    highp vec2 param_89 = vec2(sdConeSection(param_84, param_85, param_86, param_87), 13.6700000762939453125);
    res = opU(param_88, param_89);
    highp vec3 param_90 = pos - vec3(1.0, 0.3499999940395355224609375, -2.0);
    highp vec3 param_91 = vec3(0.1500000059604644775390625, 0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 param_92 = res;
    highp vec2 param_93 = vec2(sdEllipsoid(param_90, param_91), 43.1699981689453125);
    res = opU(param_92, param_93);
    return res;
}

highp vec2 castRay(highp vec3 ro, highp vec3 rd)
{
    highp float tmin = 1.0;
    highp float tmax = 20.0;
    highp float tp1 = (0.0 - ro.y) / rd.y;
    if (tp1 > 0.0)
    {
        tmax = min(tmax, tp1);
    }
    highp float tp2 = (1.60000002384185791015625 - ro.y) / rd.y;
    if (tp2 > 0.0)
    {
        if (ro.y > 1.60000002384185791015625)
        {
            tmin = max(tmin, tp2);
        }
        else
        {
            tmax = min(tmax, tp2);
        }
    }
    highp float t = tmin;
    highp float m = -1.0;
    for (int i = 0; i < 64; i++)
    {
        highp float precis = 0.0005000000237487256526947021484375 * t;
        highp vec3 param = ro + (rd * t);
        highp vec2 res = map(param);
        if ((res.x < precis) || (t > tmax))
        {
            break;
        }
        t += res.x;
        m = res.y;
    }
    if (t > tmax)
    {
        m = -1.0;
    }
    return vec2(t, m);
}

highp vec3 calcNormal(highp vec3 pos)
{
    highp vec2 e = vec2(0.0002886499860323965549468994140625, -0.0002886499860323965549468994140625);
    highp vec3 param = pos + e.xyy;
    highp vec3 param_1 = pos + e.yyx;
    highp vec3 param_2 = pos + e.yxy;
    highp vec3 param_3 = pos + e.xxx;
    return normalize((((e.xyy * map(param).x) + (e.yyx * map(param_1).x)) + (e.yxy * map(param_2).x)) + (e.xxx * map(param_3).x));
}

highp float calcAO(highp vec3 pos, highp vec3 nor)
{
    highp float occ = 0.0;
    highp float sca = 1.0;
    for (int i = 0; i < 5; i++)
    {
        highp float hr = 0.00999999977648258209228515625 + ((0.119999997317790985107421875 * float(i)) / 4.0);
        highp vec3 aopos = (nor * hr) + pos;
        highp vec3 param = aopos;
        highp float dd = map(param).x;
        occ += ((-(dd - hr)) * sca);
        sca *= 0.949999988079071044921875;
    }
    return clamp(1.0 - (3.0 * occ), 0.0, 1.0);
}

highp float softshadow(highp vec3 ro, highp vec3 rd, highp float mint, highp float tmax)
{
    highp float res = 1.0;
    highp float t = mint;
    for (int i = 0; i < 16; i++)
    {
        highp vec3 param = ro + (rd * t);
        highp float h = map(param).x;
        res = min(res, (8.0 * h) / t);
        t += clamp(h, 0.0199999995529651641845703125, 0.100000001490116119384765625);
        if ((h < 0.001000000047497451305389404296875) || (t > tmax))
        {
            break;
        }
    }
    return clamp(res, 0.0, 1.0);
}

highp vec3 render(highp vec3 ro, highp vec3 rd)
{
    highp vec3 col = vec3(0.699999988079071044921875, 0.89999997615814208984375, 1.0) + vec3(rd.y * 0.800000011920928955078125);
    highp vec3 param = ro;
    highp vec3 param_1 = rd;
    highp vec2 res = castRay(param, param_1);
    highp float t = res.x;
    highp float m = res.y;
    highp vec3 nor;
    highp vec3 ref;
    highp vec3 pos;
    if (m > (-0.5))
    {
        pos = ro + (rd * t);
        highp vec3 param_2 = pos;
        nor = calcNormal(param_2);
        ref = reflect(rd, nor);
        col = vec3(0.449999988079071044921875) + (sin(vec3(0.0500000007450580596923828125, 0.07999999821186065673828125, 0.100000001490116119384765625) * (m - 1.0)) * 0.3499999940395355224609375);
        if (m < 1.5)
        {
            highp float f = mod(floor(5.0 * pos.z) + floor(5.0 * pos.x), 2.0);
            col = vec3(0.300000011920928955078125) + (vec3(1.0) * (0.100000001490116119384765625 * f));
        }
        highp vec3 param_3 = pos;
        highp vec3 param_4 = nor;
        highp float occ = calcAO(param_3, param_4);
        highp vec3 lig = vec3(-0.3980148732662200927734375, 0.696526050567626953125, -0.5970222949981689453125);
        highp float amb = clamp(0.5 + (0.5 * nor.y), 0.0, 1.0);
        highp float dif = clamp(dot(nor, lig), 0.0, 1.0);
        highp float bac = clamp(dot(nor, normalize(vec3(-lig.x, 0.0, -lig.z))), 0.0, 1.0) * clamp(1.0 - pos.y, 0.0, 1.0);
        highp float dom = smoothstep(-0.100000001490116119384765625, 0.100000001490116119384765625, ref.y);
        highp float fre = pow(clamp(1.0 + dot(nor, rd), 0.0, 1.0), 2.0);
        highp float spe = pow(clamp(dot(ref, lig), 0.0, 1.0), 16.0);
        highp vec3 param_5 = pos;
        highp vec3 param_6 = lig;
        highp float param_7 = 0.0199999995529651641845703125;
        highp float param_8 = 2.5;
        dif *= softshadow(param_5, param_6, param_7, param_8);
        highp vec3 param_9 = pos;
        highp vec3 param_10 = ref;
        highp float param_11 = 0.0199999995529651641845703125;
        highp float param_12 = 2.5;
        dom *= softshadow(param_9, param_10, param_11, param_12);
        highp vec3 lin = vec3(0.0);
        lin += (vec3(1.0, 0.800000011920928955078125, 0.550000011920928955078125) * (1.2999999523162841796875 * dif));
        lin += ((vec3(1.0, 0.89999997615814208984375, 0.699999988079071044921875) * (2.0 * spe)) * dif);
        lin += ((vec3(0.4000000059604644775390625, 0.60000002384185791015625, 1.0) * (0.4000000059604644775390625 * amb)) * occ);
        lin += ((vec3(0.4000000059604644775390625, 0.60000002384185791015625, 1.0) * (0.5 * dom)) * occ);
        lin += ((vec3(0.25) * (0.5 * bac)) * occ);
        lin += ((vec3(1.0) * (0.25 * fre)) * occ);
        col *= lin;
        col = mix(col, vec3(0.800000011920928955078125, 0.89999997615814208984375, 1.0), vec3(1.0 - exp((((-0.00019999999494757503271102905273438) * t) * t) * t)));
    }
    return vec3(clamp(col, vec3(0.0), vec3(1.0)));
}

void mainImage(out highp vec4 fragColor, highp vec2 fragCoord)
{
    highp vec2 mo = _1518.iMouse.xy / _1518.iResolution.xy;
    highp float time = 15.0 + _1518.iTime;
    highp vec3 tot = vec3(0.0);
    highp vec2 p = ((-_1518.iResolution.xy) + (fragCoord * 2.0)) / vec2(_1518.iResolution.y);
    highp vec3 ro = vec3((-0.5) + (3.5 * cos((0.100000001490116119384765625 * time) + (6.0 * mo.x))), 1.0 + (2.0 * mo.y), 0.5 + (4.0 * sin((0.100000001490116119384765625 * time) + (6.0 * mo.x))));
    highp vec3 ta = vec3(-0.5, -0.4000000059604644775390625, 0.5);
    highp vec3 param = ro;
    highp vec3 param_1 = ta;
    highp float param_2 = 0.0;
    highp mat3 ca = setCamera(param, param_1, param_2);
    highp vec3 rd = ca * normalize(vec3(p, 2.0));
    highp vec3 param_3 = ro;
    highp vec3 param_4 = rd;
    highp vec3 col = render(param_3, param_4);
    col = pow(col, vec3(0.4544999897480010986328125));
    tot += col;
    fragColor = vec4(tot, 1.0);
}

void main()
{
    highp vec4 color = vec4(0.0, 0.0, 0.0, 1.0);
    highp vec2 param_1 = gl_FragCoord.xy;
    highp vec4 param;
    mainImage(param, param_1);
    color = param;
    color.w = 1.0;
    outColor = color;
}
#version 450 es
precision mediump float;
precision highp int;

struct _1514
{
    highp vec3 _m0;
    highp float _m1;
};

layout(std140) uniform _1516_1518
{
    highp vec3 _m0;
    highp float _m1;
    highp float _m2[4];
    highp vec4 _m3;
    highp vec4 _m4;
    highp float _m5;
    highp vec3 _m6[4];
    int _m7;
    highp float _m8;
    highp float _m9;
    _1514 _m10[4];
} _1518;

uniform mediump sampler2D _1629;
uniform mediump sampler2D _1630;
uniform mediump sampler2D _1631;
uniform mediump sampler2D _1632;

layout(location = 0) out highp vec4 _1624;

highp mat3 _148(highp vec3 _145, highp vec3 _146, highp float _147)
{
    highp vec3 _1471 = normalize(_146 - _145);
    highp vec3 _1476 = vec3(sin(_147), cos(_147), 0.0);
    highp vec3 _1482 = normalize(cross(_1471, _1476));
    highp vec3 _1487 = normalize(cross(_1482, _1471));
    return mat3(vec3(_1482), vec3(_1487), vec3(_1471));
}

highp float _11(highp vec3 _10)
{
    return _10.y;
}

highp float _17(highp vec3 _15, highp float _16)
{
    return length(_15) - _16;
}

highp vec2 _105(highp vec2 _103, highp vec2 _104)
{
    return mix(_104, _103, bvec2(_103.x < _104.x));
}

highp float _22(highp vec3 _20, highp vec3 _21)
{
    highp vec3 _169 = abs(_20) - _21;
    return min(max(_169.x, max(_169.y, _169.z)), 0.0) + length(max(_169, vec3(0.0)));
}

highp float _32(highp vec3 _29, highp vec3 _30, highp float _31)
{
    return length(max(abs(_29) - _30, vec3(0.0))) - _31;
}

highp float _39(highp vec3 _37, highp vec2 _38)
{
    return length(vec2(length(_37.xz) - _38.x, _37.y)) - _38.y;
}

highp float _50(highp vec3 _46, highp vec3 _47, highp vec3 _48, highp float _49)
{
    highp vec3 _274 = _46 - _47;
    highp vec3 _278 = _48 - _47;
    highp float _282 = clamp(dot(_274, _278) / dot(_278, _278), 0.0, 1.0);
    return length(_274 - (_278 * _282)) - _49;
}

highp float _54(highp vec3 _52, highp vec2 _53)
{
    highp vec3 _301 = abs(_52);
    highp float _304 = _301.z - _53.y;
    highp float _310 = max((_301.x * 0.86602497100830078125) + (_52.y * 0.5), -_52.y) - (_53.x * 0.5);
    return length(max(vec2(_304, _310), vec2(0.0))) + min(max(_304, _310), 0.0);
}

highp float _58(highp vec3 _56, highp vec2 _57)
{
    highp vec2 _339 = abs(vec2(length(_56.xz), _56.y)) - _57;
    return min(max(_339.x, _339.y), 0.0) + length(max(_339, vec2(0.0)));
}

highp float _62(highp vec3 _60, highp vec3 _61)
{
    highp vec2 _362 = vec2(length(_60.xz), _60.y);
    highp float _369 = (-_362.y) - _61.z;
    highp float _376 = max(dot(_362, _61.xy), _362.y);
    return length(max(vec2(_369, _376), vec2(0.0))) + min(max(_369, _376), 0.0);
}

highp float _77(highp vec2 _76)
{
    return sqrt((_76.x * _76.x) + (_76.y * _76.y));
}

highp float _83(inout highp vec2 _82)
{
    _82 *= _82;
    _82 *= _82;
    _82 *= _82;
    return pow(_82.x + _82.y, 0.125);
}

highp float _87(highp vec3 _85, highp vec2 _86)
{
    highp vec2 _568 = _85.xz;
    highp vec2 _567 = vec2(_77(_568) - _86.x, _85.y);
    highp vec2 _578 = _567;
    highp float _580 = _83(_578);
    return _580 - _86.y;
}

highp float _91(highp vec3 _89, highp vec2 _90)
{
    highp vec2 _587 = _89.xz;
    highp float _590 = _83(_587);
    highp vec2 _586 = vec2(_590 - _90.x, _89.y);
    highp vec2 _597 = _586;
    highp float _599 = _83(_597);
    return _599 - _90.y;
}

highp float _80(inout highp vec2 _79)
{
    _79 = (_79 * _79) * _79;
    _79 *= _79;
    return pow(_79.x + _79.y, 0.16666667163372039794921875);
}

highp float _95(highp vec3 _93, highp vec2 _94)
{
    highp vec2 _605 = _93.xz;
    highp float _608 = _80(_605);
    return max(_608 - _94.x, abs(_93.y) - _94.y);
}

highp float _43(highp vec3 _41, highp vec2 _42)
{
    highp vec3 _236 = abs(_41);
    highp float _239 = _236.z - _42.y;
    highp float _245 = max((_236.x * 0.86602497100830078125) + (_236.y * 0.5), _236.y) - _42.x;
    return length(max(vec2(_239, _245), vec2(0.0))) + min(max(_239, _245), 0.0);
}

highp float _73(highp vec3 _71, highp vec3 _72)
{
    highp vec3 _461 = _71 - vec3(0.0, (-2.0) * _72.z, 0.0);
    highp vec3 _462 = vec3(2.0 * _72.z);
    highp float _448 = _22(_461, _462);
    highp float _464 = 0.0;
    _464 = max(_464, abs(dot(_71, vec3(-_72.x, _72.y, 0.0))));
    _464 = max(_464, abs(dot(_71, vec3(_72.x, _72.y, 0.0))));
    _464 = max(_464, abs(dot(_71, vec3(0.0, _72.y, _72.x))));
    _464 = max(_464, abs(dot(_71, vec3(0.0, _72.y, -_72.x))));
    highp float _507 = _464 - _72.z;
    return max(-_448, _507);
}

highp float _100(highp float _98, highp float _99)
{
    return max(-_99, _98);
}

highp vec3 _110(highp vec3 _108, highp vec3 _109)
{
    return mod(_108, _109) - (_109 * 0.5);
}

highp vec3 _114(highp vec3 _113)
{
    highp float _648 = cos((10.0 * _113.y) + 10.0);
    highp float _655 = sin((10.0 * _113.y) + 10.0);
    highp mat2 _663 = mat2(vec2(_648, -_655), vec2(_655, _648));
    return vec3(_663 * _113.xz, _113.y);
}

highp float _69(highp vec3 _65, highp float _66, highp float _67, highp float _68)
{
    highp float _397 = (-_65.y) - _66;
    highp float _403 = _65.y - _66;
    highp float _408 = (0.5 * (_67 - _68)) / _66;
    highp float _415 = max((sqrt(dot(_65.xz, _65.xz) * (1.0 - (_408 * _408))) + (_403 * _408)) - _68, _403);
    return length(max(vec2(_397, _415), vec2(0.0))) + min(max(_397, _415), 0.0);
}

highp float _26(highp vec3 _24, highp vec3 _25)
{
    return (length(_24 / _25) - 1.0) * min(min(_25.x, _25.y), _25.z);
}

highp vec2 _118(highp vec3 _117)
{
    highp vec3 _684 = _117;
    highp vec3 _692 = _117 - vec3(0.0, 0.25, 0.0);
    highp float _693 = 0.25;
    highp vec2 _697 = vec2(_11(_684), 1.0);
    highp vec2 _698 = vec2(_17(_692, _693), 46.90000152587890625);
    highp vec2 _683 = _105(_697, _698);
    highp vec3 _704 = _117 - vec3(1.0, 0.25, 0.0);
    highp vec3 _705 = vec3(0.25);
    highp vec2 _709 = _683;
    highp vec2 _711 = vec2(_22(_704, _705), 3.0);
    _683 = _105(_709, _711);
    highp vec3 _719 = _117 - vec3(1.0, 0.25, 1.0);
    highp vec3 _720 = vec3(0.1500000059604644775390625);
    highp float _721 = 0.100000001490116119384765625;
    highp vec2 _725 = _683;
    highp vec2 _727 = vec2(_32(_719, _720, _721), 41.0);
    _683 = _105(_725, _727);
    highp vec3 _735 = _117 - vec3(0.0, 0.25, 1.0);
    highp vec2 _736 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 _740 = _683;
    highp vec2 _742 = vec2(_39(_735, _736), 25.0);
    _683 = _105(_740, _742);
    highp vec3 _749 = _117;
    highp vec3 _751 = vec3(-1.2999999523162841796875, 0.100000001490116119384765625, -0.100000001490116119384765625);
    highp vec3 _752 = vec3(-0.800000011920928955078125, 0.5, 0.20000000298023223876953125);
    highp float _753 = 0.100000001490116119384765625;
    highp vec2 _757 = _683;
    highp vec2 _759 = vec2(_50(_749, _751, _752, _753), 31.8999996185302734375);
    _683 = _105(_757, _759);
    highp vec3 _766 = _117 - vec3(-1.0, 0.25, -1.0);
    highp vec2 _767 = vec2(0.25, 0.0500000007450580596923828125);
    highp vec2 _771 = _683;
    highp vec2 _773 = vec2(_54(_766, _767), 43.5);
    _683 = _105(_771, _773);
    highp vec3 _780 = _117 - vec3(1.0, 0.300000011920928955078125, -1.0);
    highp vec2 _781 = vec2(0.100000001490116119384765625, 0.20000000298023223876953125);
    highp vec2 _785 = _683;
    highp vec2 _787 = vec2(_58(_780, _781), 8.0);
    _683 = _105(_785, _787);
    highp vec3 _795 = _117 - vec3(0.0, 0.5, -1.0);
    highp vec3 _796 = vec3(0.800000011920928955078125, 0.60000002384185791015625, 0.300000011920928955078125);
    highp vec2 _800 = _683;
    highp vec2 _802 = vec2(_62(_795, _796), 55.0);
    _683 = _105(_800, _802);
    highp vec3 _807 = _117 - vec3(0.0, 0.25, 2.0);
    highp vec2 _808 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 _812 = _683;
    highp vec2 _814 = vec2(_87(_807, _808), 50.0);
    _683 = _105(_812, _814);
    highp vec3 _819 = _117 - vec3(-1.0, 0.25, 2.0);
    highp vec2 _820 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 _824 = _683;
    highp vec2 _826 = vec2(_91(_819, _820), 43.0);
    _683 = _105(_824, _826);
    highp vec3 _831 = _117 - vec3(1.0, 0.300000011920928955078125, 2.0);
    highp vec2 _832 = vec2(0.100000001490116119384765625, 0.20000000298023223876953125);
    highp vec2 _836 = _683;
    highp vec2 _838 = vec2(_95(_831, _832), 12.0);
    _683 = _105(_836, _838);
    highp vec3 _843 = _117 - vec3(-1.0, 0.20000000298023223876953125, 1.0);
    highp vec2 _844 = vec2(0.25, 0.0500000007450580596923828125);
    highp vec2 _848 = _683;
    highp vec2 _850 = vec2(_43(_843, _844), 17.0);
    _683 = _105(_848, _850);
    highp vec3 _856 = _117 - vec3(-1.0, 0.1500000059604644775390625, -2.0);
    highp vec3 _857 = vec3(0.800000011920928955078125, 0.60000002384185791015625, 0.25);
    highp vec2 _861 = _683;
    highp vec2 _863 = vec2(_73(_856, _857), 37.0);
    _683 = _105(_861, _863);
    highp vec3 _868 = _117 - vec3(-2.0, 0.20000000298023223876953125, 1.0);
    highp vec3 _869 = vec3(0.1500000059604644775390625);
    highp float _870 = 0.0500000007450580596923828125;
    highp vec3 _874 = _117 - vec3(-2.0, 0.20000000298023223876953125, 1.0);
    highp float _875 = 0.25;
    highp float _877 = _32(_868, _869, _870);
    highp float _878 = _17(_874, _875);
    highp vec2 _882 = _683;
    highp vec2 _884 = vec2(_100(_877, _878), 13.0);
    _683 = _105(_882, _884);
    highp vec3 _890 = _117 - vec3(-2.0, 0.20000000298023223876953125, 0.0);
    highp vec2 _891 = vec2(0.20000000298023223876953125, 0.100000001490116119384765625);
    highp vec3 _911 = vec3(atan(_117.x + 2.0, _117.z) / 6.283100128173828125, _117.y, 0.0199999995529651641845703125 + (0.5 * length(_117 - vec3(-2.0, 0.20000000298023223876953125, 0.0))));
    highp vec3 _912 = vec3(0.0500000007450580596923828125, 1.0, 0.0500000007450580596923828125);
    highp vec3 _915 = _110(_911, _912);
    highp vec2 _916 = vec2(0.0199999995529651641845703125, 0.60000002384185791015625);
    highp float _918 = _87(_890, _891);
    highp float _919 = _58(_915, _916);
    highp vec2 _923 = _683;
    highp vec2 _925 = vec2(_100(_918, _919), 51.0);
    _683 = _105(_923, _925);
    highp vec3 _930 = _117 - vec3(-2.0, 0.25, -1.0);
    highp float _931 = 0.20000000298023223876953125;
    highp vec2 _953 = _683;
    highp vec2 _955 = vec2((0.5 * _17(_930, _931)) + (((0.02999999932944774627685546875 * sin(50.0 * _117.x)) * sin(50.0 * _117.y)) * sin(50.0 * _117.z)), 65.0);
    _683 = _105(_953, _955);
    highp vec3 _960 = _117 - vec3(-2.0, 0.25, 2.0);
    highp vec3 _962 = _114(_960);
    highp vec2 _963 = vec2(0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 _968 = _683;
    highp vec2 _970 = vec2(0.5 * _39(_962, _963), 46.700000762939453125);
    _683 = _105(_968, _970);
    highp vec3 _976 = _117 - vec3(0.0, 0.3499999940395355224609375, -2.0);
    highp float _977 = 0.1500000059604644775390625;
    highp float _978 = 0.20000000298023223876953125;
    highp float _979 = 0.100000001490116119384765625;
    highp vec2 _983 = _683;
    highp vec2 _985 = vec2(_69(_976, _977, _978, _979), 13.6700000762939453125);
    _683 = _105(_983, _985);
    highp vec3 _991 = _117 - vec3(1.0, 0.3499999940395355224609375, -2.0);
    highp vec3 _992 = vec3(0.1500000059604644775390625, 0.20000000298023223876953125, 0.0500000007450580596923828125);
    highp vec2 _996 = _683;
    highp vec2 _998 = vec2(_26(_991, _992), 43.1699981689453125);
    _683 = _105(_996, _998);
    return _683;
}

highp vec2 _123(highp vec3 _121, highp vec3 _122)
{
    highp float _1003 = 1.0;
    highp float _1004 = 20.0;
    highp float _1006 = (0.0 - _121.y) / _122.y;
    if (_1006 > 0.0)
    {
        _1004 = min(_1004, _1006);
    }
    highp float _1020 = (1.60000002384185791015625 - _121.y) / _122.y;
    if (_1020 > 0.0)
    {
        if (_121.y > 1.60000002384185791015625)
        {
            _1003 = max(_1003, _1020);
        }
        else
        {
            _1004 = min(_1004, _1020);
        }
    }
    highp float _1044 = _1003;
    highp float _1046 = -1.0;
    for (int _1049 = 0; _1049 < 64; _1049++)
    {
        highp float _1059 = 0.0005000000237487256526947021484375 * _1044;
        highp vec3 _1069 = _121 + (_122 * _1044);
        highp vec2 _1063 = _118(_1069);
        if ((_1063.x < _1059) || (_1044 > _1004))
        {
            break;
        }
        _1044 += _1063.x;
        _1046 = _1063.y;
    }
    if (_1044 > _1004)
    {
        _1046 = -1.0;
    }
    return vec2(_1044, _1046);
}

highp vec3 _133(highp vec3 _132)
{
    highp vec2 _1148 = vec2(0.0002886499860323965549468994140625, -0.0002886499860323965549468994140625);
    highp vec3 _1158 = _132 + _1148.xyy;
    highp vec3 _1168 = _132 + _1148.yyx;
    highp vec3 _1179 = _132 + _1148.yxy;
    highp vec3 _1190 = _132 + _1148.xxx;
    return normalize((((_1148.xyy * _118(_1158).x) + (_1148.yyx * _118(_1168).x)) + (_1148.yxy * _118(_1179).x)) + (_1148.xxx * _118(_1190).x));
}

highp float _137(highp vec3 _135, highp vec3 _136)
{
    highp float _1198 = 0.0;
    highp float _1199 = 1.0;
    for (int _1200 = 0; _1200 < 5; _1200++)
    {
        highp float _1209 = 0.00999999977648258209228515625 + ((0.119999997317790985107421875 * float(_1200)) / 4.0);
        highp vec3 _1218 = (_136 * _1209) + _135;
        highp vec3 _1225 = _1218;
        highp float _1224 = _118(_1225).x;
        _1198 += ((-(_1224 - _1209)) * _1199);
        _1199 *= 0.949999988079071044921875;
    }
    return clamp(1.0 - (3.0 * _1198), 0.0, 1.0);
}

highp float _130(highp vec3 _126, highp vec3 _127, highp float _128, highp float _129)
{
    highp float _1101 = 1.0;
    highp float _1102 = _128;
    for (int _1104 = 0; _1104 < 16; _1104++)
    {
        highp vec3 _1119 = _126 + (_127 * _1102);
        highp float _1113 = _118(_1119).x;
        _1101 = min(_1101, (8.0 * _1113) / _1102);
        _1102 += clamp(_1113, 0.0199999995529651641845703125, 0.100000001490116119384765625);
        if ((_1113 < 0.001000000047497451305389404296875) || (_1102 > _129))
        {
            break;
        }
    }
    return clamp(_1101, 0.0, 1.0);
}

highp vec3 _141(highp vec3 _139, highp vec3 _140)
{
    highp vec3 _1248 = vec3(0.699999988079071044921875, 0.89999997615814208984375, 1.0) + vec3(_140.y * 0.800000011920928955078125);
    highp vec3 _1258 = _139;
    highp vec3 _1260 = _140;
    highp vec2 _1257 = _123(_1258, _1260);
    highp float _1263 = _1257.x;
    highp float _1266 = _1257.y;
    highp vec3 _1280;
    highp vec3 _1284;
    highp vec3 _1274;
    if (_1266 > (-0.5))
    {
        _1274 = _139 + (_140 * _1263);
        highp vec3 _1281 = _1274;
        _1280 = _133(_1281);
        _1284 = reflect(_140, _1280);
        _1248 = vec3(0.449999988079071044921875) + (sin(vec3(0.0500000007450580596923828125, 0.07999999821186065673828125, 0.100000001490116119384765625) * (_1266 - 1.0)) * 0.3499999940395355224609375);
        if (_1266 < 1.5)
        {
            highp float _1303 = mod(floor(5.0 * _1274.z) + floor(5.0 * _1274.x), 2.0);
            _1248 = vec3(0.300000011920928955078125) + (vec3(1.0) * (0.100000001490116119384765625 * _1303));
        }
        highp vec3 _1322 = _1274;
        highp vec3 _1324 = _1280;
        highp float _1321 = _137(_1322, _1324);
        highp vec3 _1327 = vec3(-0.3980148732662200927734375, 0.696526050567626953125, -0.5970222949981689453125);
        highp float _1332 = clamp(0.5 + (0.5 * _1280.y), 0.0, 1.0);
        highp float _1338 = clamp(dot(_1280, _1327), 0.0, 1.0);
        highp float _1343 = clamp(dot(_1280, normalize(vec3(-_1327.x, 0.0, -_1327.z))), 0.0, 1.0) * clamp(1.0 - _1274.y, 0.0, 1.0);
        highp float _1360 = smoothstep(-0.100000001490116119384765625, 0.100000001490116119384765625, _1284.y);
        highp float _1364 = pow(clamp(1.0 + dot(_1280, _140), 0.0, 1.0), 2.0);
        highp float _1371 = pow(clamp(dot(_1284, _1327), 0.0, 1.0), 16.0);
        highp vec3 _1379 = _1274;
        highp vec3 _1381 = _1327;
        highp float _1383 = 0.0199999995529651641845703125;
        highp float _1384 = 2.5;
        _1338 *= _130(_1379, _1381, _1383, _1384);
        highp vec3 _1388 = _1274;
        highp vec3 _1390 = _1284;
        highp float _1392 = 0.0199999995529651641845703125;
        highp float _1393 = 2.5;
        _1360 *= _130(_1388, _1390, _1392, _1393);
        highp vec3 _1397 = vec3(0.0);
        _1397 += (vec3(1.0, 0.800000011920928955078125, 0.550000011920928955078125) * (1.2999999523162841796875 * _1338));
        _1397 += ((vec3(1.0, 0.89999997615814208984375, 0.699999988079071044921875) * (2.0 * _1371)) * _1338);
        _1397 += ((vec3(0.4000000059604644775390625, 0.60000002384185791015625, 1.0) * (0.4000000059604644775390625 * _1332)) * _1321);
        _1397 += ((vec3(0.4000000059604644775390625, 0.60000002384185791015625, 1.0) * (0.5 * _1360)) * _1321);
        _1397 += ((vec3(0.25) * (0.5 * _1343)) * _1321);
        _1397 += ((vec3(1.0) * (0.25 * _1364)) * _1321);
        _1248 *= _1397;
        _1248 = mix(_1248, vec3(0.800000011920928955078125, 0.89999997615814208984375, 1.0), vec3(1.0 - exp((((-0.00019999999494757503271102905273438) * _1263) * _1263) * _1263)));
    }
    return vec3(clamp(_1248, vec3(0.0), vec3(1.0)));
}

void _155(out highp vec4 _153, highp vec2 _154)
{
    highp vec2 _1510 = _1518._m3.xy / _1518._m0.xy;
    highp float _1529 = 15.0 + _1518._m1;
    highp vec3 _1535 = vec3(0.0);
    highp vec2 _1536 = ((-_1518._m0.xy) + (_154 * 2.0)) / vec2(_1518._m0.y);
    highp vec3 _1548 = vec3((-0.5) + (3.5 * cos((0.100000001490116119384765625 * _1529) + (6.0 * _1510.x))), 1.0 + (2.0 * _1510.y), 0.5 + (4.0 * sin((0.100000001490116119384765625 * _1529) + (6.0 * _1510.x))));
    highp vec3 _1574 = vec3(-0.5, -0.4000000059604644775390625, 0.5);
    highp vec3 _1579 = _1548;
    highp vec3 _1581 = _1574;
    highp float _1583 = 0.0;
    highp mat3 _1578 = _148(_1579, _1581, _1583);
    highp vec3 _1585 = _1578 * normalize(vec3(_1536, 2.0));
    highp vec3 _1594 = _1548;
    highp vec3 _1596 = _1585;
    highp vec3 _1593 = _141(_1594, _1596);
    _1593 = pow(_1593, vec3(0.4544999897480010986328125));
    _1535 += _1593;
    _153 = vec4(_1535, 1.0);
}

void main()
{
    highp vec4 _1611 = vec4(0.0, 0.0, 0.0, 1.0);
    highp vec2 _1616 = gl_FragCoord.xy;
    highp vec4 _1615;
    _155(_1615, _1616);
    _1611 = _1615;
    _1611.w = 1.0;
    _1624 = _1611;
}