struct C2E2f_Output { 
	float4 color: COLOR;
};


C2E2f_Output main (    float4 oPosition : TEXCOORD1,
                      float2 oUV : TEXCOORD0,
                      float4 HCOL : COLOR, 
                      
	float4 HCOL2 : COLOR1,
                      
                      float3 oLight : TEXCOORD2,
                      float3 oHalf : TEXCOORD4,
                      float2 uvl : TEXCOORD5,
                      float3 oNormal : TEXCOORD3,


                   uniform sampler2D decal,
				   uniform sampler2D light,
                //   uniform samplerCUBE cube,
				   uniform sampler2D texture,
       
				   uniform sampler2D texture2,
//                   uniform samplerCUBE cube
//                   uniform sampler2D cubes
uniform float intersection

                   ) 
{


	C2E2f_Output OUT;


float4 cll4=tex2Dproj (light,oPosition*float4 (9,9,1,1));

cll4-=intersection;
cll4*=100;
//cll4=saturate (cll4);
cll4=1-cll4;

OUT.color=cll4.xxxx;
//cll4*=intersection*0.01;
//+0.01*intersection*cll4.xxxx+float4 (0,0,0,1);
//OUT.color=(HCOL2*HCOL2*1*float4 (0.9,0.5,0,0)           +0*HCOL);

//OUT.color=HCOL;

/*
OUT.color=(HCOL2*0.1
           +0*HCOL)*4;
*/
//OUT.color=cll4;
/*



OUT.color=(
           +1*HCOL)*2+kk*0.17;
*/
//OUT.color=(           3*HCOL)*3;

//kk=round (kk*5)/5.0f;
//OUT.color=kk;
//OUT.color=cll1;
//OUT.color=maxx*((basetexture*HCOL2+HCOL2+0.3*mx));
//OUT.color=HCOL2*maxx;
//OUT.color=float4 (1,1,1,1)*maxx;
//OUT.color=1*((basetexture*HCOL2+HCOL2+0.3*mx));
//OUT.color=basetexture;
//OUT.color=1*((basetexture*HCOL2+HCOL2+0.3*mx))*(cll1*4);
//
//OUT.color=1*((basetexture*HCOL2+HCOL2+0.4*mx));
//OUT.color=1*((basetexture*HCOL2+HCOL2+0.3*mx));
//OUT.color=HCOL2*basetexture+HCOL2*mx;
//OUT.color=HCOL2;
//OUT.color=1*(basetexture*HCOL2+HCOL2);
//OUT.color=0;
//OUT.color.w=0.5;

	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;




}
*/