// in which two textures get rendered on top of each other
uniform sampler2D baseMap;
uniform sampler2D gaussianMap;
varying vec2 Texcoord;

void main(void)
{
	vec4 base = texture2D(baseMap, Texcoord);
	vec4 blur = texture2D(gaussianMap, Texcoord);
	blur = clamp(blur, 0.0, 1.0);
	float blurStrength = pow(1 - dot(base.xyz, vec3(0.3, 0.59, 0.11)), 3.0);
	blur *= blurStrength;
	float shadow = 1 - dot(blur.xyz, vec3(0.3, 0.59, 0.11));
	shadow = clamp(pow(shadow + 0.3, 2.0), 0.0, 1.0);
	blur = max(blur-0.5, 0.0);
	float gause = dot(blur.xyz, vec3(0.3, 0.59, 0.11));
	//base -= gause * (1 - dot(base.xyz, vec3(0.3, 0.59, 0.11); //shadows
	
	vec4 finalColor = base * shadow;
	//finalColor.xyz = blur;//pow(finalColor.xyz, 2.0);
	finalColor.xyz *= vec3(1, 1.02, 1);
	finalColor.a = 1.0;
	gl_FragColor = finalColor;
}