float4 main(float3 position : POSITION,
	 		float2 texcoord : TEXCOORD0,
	 		float3 innormal : COLOR0,
	 		uniform float wankutin,
	 		uniform sampler2D texture1) : COLOR0
{
	float3 color1 = tex2D(texture1, texcoord).rgb;

	float3 normal = innormal*2.0-1.0;

	float sinval1 = 1-abs(normal.x+normal.y+normal.z);
	float sinval2=1-sinval1;

	sinval1=sinval1*sinval1*sinval1;
	sinval2=sinval2*sinval2*sinval2;

	float3 ambiColor = saturate(sinval1*color1);
	float3 c2mul = float3(0.5, 0.75, 1.0);
	float3 ambiColor2 = saturate(sinval2*color1*c2mul);

/*
	float3 ambiColor = float3(sinval1*color1.r,
	                          sinval1*color1.g,
	                          sinval1*color1.b);

	float3 ambiColor2 = float3(sinval2*color1.r*0.5,
	                           sinval2*color1.g*0.75,
	                           sinval2*color1.b);

	if(ambiColor.r>1)ambiColor.r=1;
	if(ambiColor.g>1)ambiColor.g=1;
	if(ambiColor.b>1)ambiColor.b=1;
	if(ambiColor2.r>1)ambiColor2.r=1;
	if(ambiColor2.g>1)ambiColor2.g=1;
	if(ambiColor2.b>1)ambiColor2.b=1;
*/
	//return float4(normal, 1.0);

//	return float4(ambiColor*wankutin+color1*(1-wankutin),1);
	return float4(ambiColor*wankutin+ambiColor2*(1-ambiColor)*(1-wankutin),1);

}