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 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 lightPosition

                   ) 
{



float dd=0.06;
//float (int(-oPosition2.y))*0.002+0.1;
//if (cos (oThePos.y*dd+0.7)*cos (oThePos.x*dd)<-0.5) discard;
//if (cos (oThePos.x*dd+1)*0.0045*(oThePos.y+50)<-0.099) discard;
dd=-1.1-pow((oPosition2.y+36),3)*0.00002;
if (dd>0.5) dd=0.5;



if (cos (oThePos.x*0.06)<dd) discard;
if (cos (oThePos.y*2.8)*cos (oThePos.x*2.8)<-0.7) discard;






float mul1=tex2D(decal,oThePos.xz*0.03).x*tex2D(decal,oThePos.xy*0.03).y;











    float4 basetexture=tex2D (texture2,oUV);
   
//lighttexture=tex2D (lightmap,oUV);
//float3 normals=tex2D (texture,oUV);


float3 normal=((tex2D (texture,oUV)-0.5)*2);



 
// if (tex2D(decal,oThePos.xz*0.15).x*tex2D(decal,oThePos.xy*0.11).x+(abs(oThePos.y+3))*0.125>0.73) discard;





 

//if (sin(oThePos.y*planecut)*cos(oThePos.z*planecut)>0.9) discard;

float4 nrr=oThePos.xyzz;





float4 cll1=tex2Dproj (decal,oPosition);


basetexture=tex2D (texture2,oUV)+0.4;
 float4 cll4=tex2Dproj (decal,oPosition.xyw);
 


//if ((sin(oThePos.y*planecut)+cos(oThePos.x*planecut))>0.9) discard;


//float zmm=1+abs(10*(sin(oThePos.y*planecut)*(sin(oThePos.x*planecut))));

//if (pow(sin(oThePos.y*planecut),10)+pow(sin(oThePos.z*planecut),10)>0.9) discard;


//oPosition2.xy+=cll4.xy*1.5;
//oPosition2.xyz+=cll4.xyz*0.01;
 //basetexture=2*(tex2D (light,-4*oPosition2.xy))+0.1;
//basetexture=100*tex2D(decal,oThePos.xz*0.22).y*tex2D(decal,oThePos.xy*0.03).y;
basetexture=1; 
//basetexture*=cll4;
 //oPosition2.xy+=cll4.xy*20;
// oPosition.xyw+=100*HCOL2.xyz;
 //float4 cll4n=tex2Dproj (decal,oPosition.xyw);




 //if (tex2D (light,-1*oPosition2.xy).x*10<planecut) discard;




 //oPosition2.xy+=HCOL2.xy;

/*
OUT.color=(HCOL2*basetexture*maxx+mx*cll4);
OUT.color=(maxx*HCOL2*basetexture+HCOL*mx)*(0.5+0.5*cll1);
*/
//OUT.color=maxx*((basetexture*HCOL2+HCOL2+0.3*mx))*(0.6+0.4*cll1);
//OUT.color=maxx*((basetexture*HCOL2+HCOL2+0.3*mx));
//
float4 coll=tex2D(light,-oUV*0.5)*float4 (0.8,0.3,0.2,1);
//OUT.color=(tex2D (decal,oUV*9))*0.7*(cll4+0.5)*(basetexture)*0.4*HCOL2;
//OUT.color=(tex2D (decal,oUV*11))*(cll4+0.5)*(basetexture)*HCOL2;







oColor1=(oNormal.xyzz+1)*0.5;
//oColor1*=saturate (pow(Ramp.x*5,10));
//if (cll4.x< 

//if ((oPosition.z)/oPosition.w<cll4+0.0001)  cll4=1; else cll4=0;

//oColor2=(HCOL*basetexture*0.5+HCOL2*float4 (0.1,0.1,0.3,0.1))*1.0;
oColor2=HCOL2;
//*float4 (0.1,0.2,0.3,0.1)*2.0;

//oColor2*=HCOL2*float4 (0.1,0.2,0.3,1)*200000*pow (tex2D(decal,oThePos.xz*0.02).y*tex2D(decal,oThePos.xy*0.03).y,6);
//oColor2*=1+float4 (0.2,0.6,1,1)*4000*saturate (pow (tex2D(decal,oThePos.xz*0.02).y*tex2D(decal,oThePos.xy*0.03).y,6)-0.001);
oColor2*=0.2+0.05*float4 (0.5,0.5,0.5,1)*4000*saturate (pow (mul1,6)-0.003);
//cond2=saturate (cond2);
oColor2+=float4 (0.015,0.023,0.04,1)*0.5;

//oColor2+=saturate(1.0*ffx-cond2)*2*float4 (1,0.2,0.1,1)*saturate (1-diff);
//oColor2+=HCOL;
//oColor2+=pow (saturate (cond1),8)*float4 (1,0.1,0.1,1)*ttime;


//oColor2+=saturate(1.0*ffx-cond2)*2*float4 (0.4,0.4,0.4,1)*saturate (1-diff);
//oColor2+=pow (saturate (cond1),8)*float4 (0.1,0.1,1.1,1)*ttime;

//oColor2+=(1.5-cond2)*0.1*float4 (0,1.2,1.1,1);
//oColor2=basetexture;
//oColor2=(HCOL2)*float4 (0.2,0.3,0.4,1);
//oColor2=float4 (1,0,0,0);
//oColor2=cll4;
//oColor2*=1+1*tex2D (light,oPosition.xy*0.01);
oColor2.w=Ramp.x*8;

//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;




}
*/