 uniform Light lights[MAX_LIGHTS];
 
 layout (location = 0) out vec4 color;
-layout (location = 1) out vec4 BrightColor;  
+layout (location = 1) out vec4 BrightColor;
 
 in vec2 fragTexCoords;
 in vec4 fragPos; // view space

	return att * diffuse;
}

// source: https://www.shadertoy.com/view/4ljXWh
vec3 caustic(vec2 uv)
{
    vec2 p = mod(uv*TAU, TAU)-250.0;
    float offset = time * .5+23.0; //time * .5+23.0;

	vec2 i = vec2(p);
	float c = 1.0;
	float inten = .005;

	for (int n = 0; n < MAX_ITER; n++)
	{
		float t = offset * (1.0 - (3.5 / float(n+1)));
		i = p + vec2(cos(t - i.x) + sin(t + i.y), sin(t - i.y) + cos(t + i.x));
		c += 1.0/length(vec2(p.x / (sin(i.x+t)/inten),p.y / (cos(i.y+t)/inten)));
	}

	c /= float(MAX_ITER);
	c = 1.17-pow(c, 1.4);
	vec3 color = vec3(pow(abs(c), 8.0));
    color = clamp(color + vec3(0.0, 0.35, 0.5), 0.0, 1.0);
    //color = mix(color, vec3(1.0,1.0,1.0),0.3);

    return color;
}


	color = mix(fogColor, materialColor, fogFactor);
	color.a = 1.0;

	//color *= 5.5;

	// -- EXTRACT BRIGHT PIXELS --

	float bloomThreshold = averageLuminosity * 3;  // factor seems a bit arbitrary, comes from the low life of averageLuminosity

	// calculate brigthness by applying luminosity contribution of rgb colors (see https://en.wikipedia.org/wiki/Relative_luminance)
	float brightness = dot(color.rgb, vec3(0.2126, 0.7152, 0.0722));
	if(brightness > bloomThreshold)
