Original Post
Hello. I finally have created a shadow volume, but now i do not know how to render it propely I create a black quad, and i render it on the screen. At first,i render the original geometry, then the shadow volume and finally the quad. But really i'm not able to see a decent shadow. Here is how i'm working Geometry Rendering: simple Vertex and Pixel Shader, with this values Shadow Volume rendering: Simple Vertex and Pixel shader, an extruding Geometry Shader that works. Quad Rendering: Simple Vertex and Pixel Shader (Vertex shader simply returns position, pixel returns 0), with this values (stencil ref = 1) What about you? Now i would ask: what is and why do i need additive blending?
DepthStencilState DefaultDepth
{
DepthEnable = true;
DepthFunc = LESS;
DepthWriteMask = ALL;
StencilEnable = false;
};
BlendState NoBlend
{
AlphaToCoverageEnable = FALSE;
BlendEnable[0] = FALSE;
RenderTargetWriteMask[0] = 0x0F;
};
RasterizerState DisableCulling
{
CullMode = NONE;
FillMode = SOLID;
};
DepthStencilState StencilShadow
{
DepthEnable = true;
DepthWriteMask = ZERO;
DepthFunc = LESS;
StencilEnable = true;
StencilReadMask = 0xFFFFFFFF;
StencilWriteMask = 0xFFFFFFFF;
FrontFaceStencilFunc = ALWAYS;
FrontFaceStencilPass = INCR;
FrontFaceStencilFail = Keep;
BackFaceStencilFunc = ALWAYS;
BackFaceStencilPass = DECR;
BackFaceStencilFail = Keep;
};
RasterizerState EnableCulling
{
CullMode = BACK;
FillMode = SOLID;
FrontCounterClockwise = FALSE;
};
DepthStencilState StencilMask
{
DepthEnable = false;
DepthWriteMask = ZERO;
DepthFunc = LESS;
StencilEnable = true;
StencilReadMask = 0xFFFFFFFF;
StencilWriteMask = 0xFFFFFFFF;
FrontFaceStencilFunc = LESS_EQUAL;
FrontFaceStencilPass = Keep;
FrontFaceStencilFail = Zero;
BackFaceStencilFunc = ALWAYS;
BackFaceStencilPass = Keep;
BackFaceStencilFail = Zero;
};