Wednesday, March 31, 2010

XNA-ShaderEffect-Shadow(Step.2)




Disable Diffuse light

DepthStencilFormat :DepthFormat.Depth24Stencil8;(According to Computer Hardware)
----------------------------------------------------------------------------------------------

            GraphicsDevice.Clear(ClearOptions.Stencil, Color.Black, 0, 0);
            GraphicsDevice.RenderState.StencilEnable = true;
            GraphicsDevice.RenderState.ReferenceStencil = 0;
            GraphicsDevice.RenderState.StencilFunction = CompareFunction.Equal;
            GraphicsDevice.RenderState.StencilPass = StencilOperation.Increment;
            GraphicsDevice.RenderState.AlphaBlendEnable = true;
            GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha;
            GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha;

----------------------------------------------------------------------------------------------
Control ShadowEffect

No comments:

Post a Comment