struct C2E2f_Output { 
	float4 color: COLOR;
};



C2E2f_Output main (    float2 oPosition : TEXCOORD0,
	uniform sampler2D decal,			   
	uniform sampler2D decal2,
    float4 cl :COLOR0
 ) 
{


	C2E2f_Output OUT;


	//float4 cl;

float ccl1;
float3 depth=tex2D (decal2,oPosition);

//float cmmt=abs(((22 * depth.x) / (220 - depth * 198)) - 40);
//float cmmt=pow(depth.x-0.001,100);
//float cmmt=1/(5*pow(depth.x,5));
float cmmt=max (0,2*depth.x-1.5);
float cmmt2=cmmt*0.3;

float2 fDerX = float2(0.13 , 0.0  ) * cmmt2;
 float2 fDerY = float2(0.0  , 0.13 ) * cmmt2;
    

float4 cmmq=tex2D (decal,oPosition,fDerX,fDerY);



float4 cmmc=tex2D (decal,oPosition);
float cll1=100+cmmc*100;
cmmt-=0.2;
cmmt=max(0,cmmt);

cll1=40-((cmmc)*900*cmmt)+(0.5-cmmt)*1500;
//cll1=max (200,cll1);
float4 cmm=tex2D (decal,round(oPosition*cll1)/cll1);
//cll1=55255;
cmmq=tex2D (decal,round(oPosition*cll1)/cll1,fDerX,fDerY);
//cmmq=tex2D (decal,oPosition,fDerX,fDerY);
//float4 cmm=tex2D (decal,oPosition);

//float4 cmm1=tex2D (decal,oPosition*1.2);
//float4 cmm2=ddx(cmm*12)+ddy(cmm*12);


//cmm*=0.9;
OUT.color=cmmq;
//cmm*(1-cmmt*4);

/*
OUT.color.x+=cmmt;
OUT.color.y+=cmmt;
OUT.color.z+=cmmt;
*/
//OUT.color=cmm2*32;
//OUT.color=round(OUT.color*13)/13.0f;
//OUT.color=cmm2*50;
//OUT.color.z=pow(cmm2.x,10)*10000;
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;




}
*/