in lowp vec4 colorV;
out vec4 fragColor;
in lowp vec2 tc;
in lowp float aspect;
in lowp float phz;
in lowp float dpth;
in lowp float mx;

float clip(float x) {
	return max(0.0, min(1.0, x * 8.0));
}
void main() {
	vec2 d = tc - vec2(0.5);
	d.y += 0.1;
	d.y *= aspect;
	float r = length(d);

	float angle = atan(d.y, d.x) - phz * 6.2832;

	float c = sin(angle + pow(r * (1.0 + dpth), 2.5) * 20.0 * pow(dpth, 4.0)) * sin(r * dpth);
	c = step(c, 0.0);
	vec3 col = mix(
		vec3(0.00392156862745098, 0.8196078431372549, 0.9921568627450981),
		vec3(0.2, 0.2549019607843137, 0.2549019607843137),
		c);

	// Output to screen
	fragColor = vec4(col, mx);
}
