VERTEX
varying float NdotL;
varying vec2 pos2;
uniform vec4 resScale;
uniform vec4 sketchOffset;
void main()
{
	
	vec4 p2= gl_ModelViewProjectionMatrix  * gl_Vertex;
	vec4 tpos = gl_ModelViewProjectionMatrix * vec4(0,0,0,1);
	pos2 = (-(tpos.xy/tpos.w))*resScale.xy + sketchOffset.xy ;

 
	gl_TexCoord[0] = gl_MultiTexCoord0;
	gl_Position = p2; 

}
PIXEL

uniform sampler2D tex, tex1;

varying vec2  pos2;
varying float NdotL ;

varying vec2 vPos;
uniform vec4 basecolor;
uniform vec4 resScale;
uniform vec4 alphaCol;
void main()
{

	vec4 c = texture2D(tex,gl_TexCoord[0].st) ;

	vec4 c2 = texture2D(tex1,gl_FragCoord.xy*resScale.zw + pos2 );
	float v2 = 1.0 - c2.x;


	float l2 = clamp(((v2-c.x))*10.0 +(c.y)*15.0,0.0,1.0);
	gl_FragColor =  basecolor * alphaCol * (l2) + basecolor *(1.0-l2);

	if(c.z <0.5)	
		discard;

	
}
