 uniform vec4 params2;
 uniform ivec4 iParams;
 uniform vec2 uClock;
+uniform ivec2 uWindow;
 uniform sampler2D uSampler;
 uniform sampler2D uNoise;
 uniform samplerCube uCubeMap;

      }
    }
  }
  if (!found /*|| x*x+y*y+z*z > radius*radius*/) {
    //gl_FragColor = vec4(textureCube(uCubeMap,eye).rgb,1.0);
    discard;
  }
  vec3 eye = vec3(a,b,c);
  // Compute gradient & normal
  float eps = 1e-3;
#if 1
  //vec3 n = vec3(Fun(x+eps,y,z,w),Fun(x,y+eps,z,w),Fun(x,y,z+eps,w)) - a0;
  vec3 n = vec3(Fun(x0+k0*a+eps,y0+k0*b,z0+k0*c,1.0),
                Fun(x0+k0*a,y0+k0*b+eps,z0+k0*c,1.0),
                Fun(x0+k0*a,y0+k0*b,z0+k0*c+eps,1.0)) - a0;
#else
  vec3 n = vec3(Fun(x+eps,y,z,w) - Fun(x-eps,y,z,w),
                Fun(x,y+eps,z,w) - Fun(x,y-eps,z,w),
                Fun(x,y,z+eps,w) - Fun(x,y,z-eps,w));
#endif
  float grad = abs(length(n));
  n = normalize(n);
  float ambient = 0.6;
  float diffuse = 1.0-ambient;

  vec3 baseColor = selectColor(vec4(x,y,z,w),eye,n);
  // Point normal towards eye
  if (dot(eye,n) > 0.0) n *= -1.0;
  vec3 color = baseColor.xyz*(ambient+(1.0-ambient)*dot(light,n));


//#define BENCHMARK
//#define FAST
#define QUALITY

//#extension GL_EXT_frag_depth : enable
precision highp float;
