struct C2E2f_Output { 
	float4 color: COLOR;
};


C2E2f_Output main (    
				   
		float2 oPosition : TEXCOORD0,
		float2 oPosition2 : TEXCOORD1,

		uniform sampler2D decala,			   
		uniform sampler2D decal3a,			   
	uniform sampler2D decal2a			   
				   ) 
{



	C2E2f_Output OUT;

float4 cl;
float cl2;



cl2=tex2D (decala,oPosition);

//cl2=1.87-cl2;
cl2=1.64-cl2;cl2=pow(cl2,16);

/*
if (cl2>0.04) cl2=1; else
if (cl2>0.01) cl2=(cl2-0.01)/0.03f;
else
cl2=0;
*/

//cl2=pow(cl2,96);
cl2=saturate (cl2);
//cl2*=3;
//cl2*=1400000;
//if (cl2>0.85) cl2=0.85;
//if (cl2>0.5) cl2=1; else cl2=0;

//cl2=0;




float4 cl3=tex2D (decal3a,oPosition);
//float4 cl2;


cl=saturate (pow(cl2,4))*cl3+(
							  1-cl2)*tex2D (decal2a,oPosition2);

cl=cl2*cl3*0+1*tex2D (decal2a,oPosition2);
//cl=cl2;
//cl=cl3*0+(0.4)*tex2D (decal2a,oPosition2);
//cl2=1-0.7*cl2;
//cl=1*tex2D (decal2a,oPosition2);
//cl=saturate(cl3)*cl2;
//cl.x*=0.2;
//cl.y*=0.7;
//cl=cl2;
//cl=cl3+cl2;


//cl=cl2;


//cl=tex2D (decal,oPosition);

/*
cl+=tex2D (decal2,oPosition);
cl+=tex2D (decal,oPosition);
cl+=tex2D (decal2,oPosition);
cl+=tex2D (decal,oPosition);
cl+=tex2D (decal2,oPosition);
cl+=tex2D (decal,oPosition);
cl+=tex2D (decal2,oPosition);
cl+=tex2D (decal,oPosition);
cl+=tex2D (decal2,oPosition);
*/
  cl=cl/1.0f;




  OUT.color=cl;

	return OUT;




}









































/* 


  FRAGMENT ENV MAP 



  struct C2E2f_Output { 
	float4 color: COLOR;
};


C2E2f_Output main (    float2 oPosition : TEXCOORD0,
    float2 oPosition2 : TEXCOORD1,
	uniform sampler2D decal,			   
	uniform sampler2D decal2					   
				   ) 
{



	C2E2f_Output OUT;

//float fc=1;
//fc=position.x;
	//float2 norm;
	//norm.x=oNormal.x;
	//norm.y=oNormal.y;

OUT.color=tex2D (decal2,oPosition);

float dx=ddx(OUT.color.x);
float dy=ddx(OUT.color.x);

oPosition2.x+=dx*1;
oPosition2.y+=dy*1;


  OUT.color=tex2D (decal,oPosition2);




  
  
  //OUT.color.y=0;
//OUT.color.z=0;
//  OUT.color-=tex2D (decal,oPosition2);


	return OUT;




}
*/