//shadow effect

//technique DebugShadows
//{
//	pass debug
//	{
//		CullMode	= CW;
//		TextureFactor	= float4(0,0,0,0.5);
//
//		ColorOp[0]	= SelectArg1;
//		ColorArg1[0]= TFactor;
//		AlphaOp[0]	= SelectArg1;
//		AlphaArg1[0]= TFactor;
//
//		AlphaBlendEnable = True;
//		SrcBlend	= SrcAlpha;
//		DestBlend	= InvSrcAlpha;
//	}
//}

technique ShadowTwoSided
{
	//Stencil value
	pass P0
	{
		ZEnable			= True;
		ZWriteEnable	= False;

		StencilEnable	= True;

		StencilRef		= 1;
		StencilMask		= 0xffffffff;
		StencilWriteMask= 0xffffffff;

		StencilFunc		= Always;
		StencilFail		= Keep;
		StencilZFail	= Keep;

		//with 2 stencil mode settings
		TwoSidedStencilMode = True;
		CCW_StencilFunc	= Always;
		CCW_StencilFail	= Keep;
		CCW_StencilZFail= Keep;
        
		//Don't want to actually draw anything
		Lighting		= False;
		ShadeMode		= Flat;

		AlphaBlendEnable= True;
		SrcBlend		= Zero;
		DestBlend		= One;

		//actual state that matters
		CullMode			= NONE;
		TwoSidedStencilMode = TRUE;

		StencilPass		= INCR;
		CCW_StencilPass	= DECR;
	}
}

technique ShadowBasic
{
	//front facing
	pass P0
	{
		CullMode		= CCW;
		StencilPass		= INCR;
	}

	//back facing
	pass P0
	{
		CullMode		= CW;
		StencilPass		= DECR;
	}
}

technique empty
{
}