void main ( 
		   float4 oPosition : TEXCOORD1,
		   float4 oPosition2 : TEXCOORD5,
		   float4 oThePos : TEXCOORD6,
                      float2 oUV : TEXCOORD0,
                      float4 HCOL : COLOR, 
                      
	float4 HCOL2 : COLOR1,
	float3 Ramp : TEXCOORD7,
                      
                      float3 oLight : TEXCOORD2,
                      float3 oHalf : TEXCOORD4,
                      float2 uvl : TEXCOORD5,
                      float3 oNormal : TEXCOORD3,



                    uniform float3 alpha,  
                    uniform float alpha2,  
                    uniform float doit,  
                    uniform float alphaplane,  
                    uniform float alphaplane2,  
                    uniform float planecut,  
                    uniform float ttime,  
                   uniform sampler2D decal,
				   uniform sampler2D light,
                 uniform samplerCUBE cube,
				   uniform sampler2D texture,
                   uniform sampler1D oned,
				   uniform sampler2D texture2,
				   out float4 oColor1: COLOR0,
out float4 oColor2: COLOR1
//                   uniform samplerCUBE cube
//                   uniform sampler2D cubes
//uniform float3 lightPositionk   v

                   ) 
{


//if (cos (oPosition2.x*0.09)*cos (oPosition2.z*0.09)<-0.4) discard;
//if (cos (oPosition2.x*0.09)*cos (oPosition2.y*0.09)<-0.4) discard;


float st=saturate ((-alphaplane2*0-oThePos.x+550)*0.001);
 //st=1;
 st+=saturate ((-alphaplane2*0-oPosition2.x+300)*0.001)*doit;

 
 if (tex2D(decal,oThePos.zx*0.001).y<st-0.02) discard;
if (tex2D(decal,oThePos.zx*0.0004).x<st+0.1) discard;


//if (cos (oThePos.z*0.5)*cos (oThePos.y*0.5)<-0.4) discard;
//if (cos (oPosition2.x*0.7)*cos (oPosition2.z*0.7)<-0.5) discard;
//if (cos (oThePos.x*0.7)*cos (oThePos.z*0.7)<-0.5) discard;
//if (cos (oThePos.z*2.0)*cos (oThePos.x*2.0)<-0.5) discard;
//if (cos (oThePos.x*0.7)*cos (oThePos.z*0.7)<-0.5) discard;

//if (cos (oPosition2.y*0.7)*cos (oPosition2.z*0.7)<-0.7) discard;

//if (cos (oPosition2.y*1.7)*cos (oPosition2.x*1.7)<-0.7) discard;





float mul1=tex2D(decal,oThePos.xz*0.005).x*tex2D(decal,oThePos.xy*0.005).y;
//if (mul1>0.35) discard;
//float cond1=mul1*0.400+alpha2*2+oThePos.y*0.1+1; if (cond1>0.97) discard;


oColor1=(oNormal.xyzz+1)*0.5;


oColor2=HCOL2*float4 (0.2,0.2,0.22,0.1)*10;
oColor2*=1+float4 (0.3,0.35,0.5,1)*300000*Ramp.x*saturate (pow (mul1,8)-0.0000);
//oColor2*=1;
oColor2+=0.5*HCOL;

//oColor2=0;
//float4 (0.3,0.3,0.3,1)*100000*Ramp.x*saturate (pow (mul1,8)-0.0002);

//oColor2=float4 (0.2,0.25,0.3,1)*0.05;
oColor2.w=Ramp.x*2;
//oColor2.w=Ramp.x;

//oColor2=(HCOL);

//oColor2=HCOL2*float4 (1,1,1,1);
//oColor2=HCOL2;
//oColor2=basetexture;
//oColor2=(oNormal.xyzz+1)*0.1;
//+HCOL2*float4 (0.2,0.3,0.4,0.1));
//oColor2=HCOL2;
//oNormal.xyzz;
//(HCOL*basetexture+HCOL2*float4 (0.2,0.3,0.4,0.1));
//oColor2=HCOL2*basetexture;





//oColor2=HCOL*0.1;;
//*basetexture;
//*cll4;
//*cll4;
//oColor2=cll4;
//OUT.color=(tex2D (decal,oUV*10))*(cll4+0.5+coll)*(basetexture)*HCOL2;

//OUT.color=*basetexture;
//basetexture*float4 (0.4,0.2,0.2,0.1);



//OUT.color=cll4;






}









































/* 


  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;




}
*/