uniform sampler2D uni_smp_base ;
uniform sampler2D uni_smp_overlay ;
uniform sampler2D uni_smp_overlay2 ; // vignette style overlay
uniform sampler2D uni_smp_overlay3 ; // vignette style overlay

vec4 color_bg1_1 = vec4(0.0,0.0,1.0,1.0) ;
vec4 color_bg1_2 = vec4(1.0,1.0,1.0,1.0) ;

void main()
{

	vec4 base_color = texture2D(uni_smp_base, gl_TexCoord[0].xy) ;
	vec4 overlay1 = texture2D(uni_smp_overlay, gl_TexCoord[0].xy) ;
	vec4 overlay2 = texture2D(uni_smp_overlay2, gl_TexCoord[0].xy) ;
	vec4 overlay3 = texture2D(uni_smp_overlay3, gl_TexCoord[0].xy) ;

	vec4 color = base_color ; //  * (2.0 * overlay1 ) ;

	float lum = smoothstep(0.0,1.0,(dot(base_color.xyz,base_color.xyz)/length(base_color.xyz))) ;

	overlay2 = smoothstep(0.0,1.0,lum)*0.4 + overlay2 ;


	//color = color * overlay2 ;
	//color = mix(color,overlay2,0.5) ;

	//
	//gl_FragColor = vec4(1.0)-(vec4(1.0)-color)/(overlay3+0.1) ;

	//gl_FragColor = mix(color,overlay3*color,1.0-dot(base_color.xyz,base_color.xyz)/length(base_color.xyz)) ;
	
	//gl_FragColor = texture2D(uni_smp_base, gl_TexCoord[0].xy) + texture2D(uni_smp_overlay, gl_TexCoord[0].xy) ;
	//gl_FragColor.b = 1.0 ; //mix(0.0,0.6,gl_FragColor.b) ;

	
	gl_FragColor = overlay2*mix(overlay2*overlay3,vec4(1.0),1.0-lum*0.5)*base_color;//mix( base_color*overlay3, base_color, lum) ;
	//gl_FragColor =overlay2*overlay3*base_color;//mix( base_color*overlay3, base_color, lum) ;
}