Jump to content
  • Advertisement
Sign in to follow this  

dx10 how to enable stencil test???

This topic is 3627 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi i´m making a shadow volume implementation and i´ve some doubts how can i render something with stencil test enabled??? i mean, i can change the depth stencil state. The stencil buffer is supposed to be filled with a previous render pass. Now i want to draw pixels only where the stencil is greater than zero i´m using this state ID3D10DepthStencilState *dx10_ds_state = NULL; D3D10_DEPTH_STENCIL_DESC ds_desc; ds_desc.DepthEnable = true; ds_desc.DepthFunc = D3D10_COMPARISON_LESS; ds_desc.DepthWriteMask = D3D10_DEPTH_WRITE_MASK_ALL; //stencil D3D10_DEPTH_STENCILOP_DESC stencil_op_front, stencil_op_back; ds_desc.StencilEnable = true; ds_desc.StencilReadMask = 0xFF; ds_desc.StencilWriteMask = 0xFF; stencil_op_front.StencilFunc = stencil_op_back.StencilFunc = 3D10_COMPARISON_GREATER; stencil_op_front.StencilDepthFailOp = stencil_op_back.StencilDepthFailOp = D3D10_STENCIL_OP_KEEP; stencil_op_front.StencilFailOp = stencil_op_back.StencilFailOp = D3D10_STENCIL_OP_KEEP; stencil_op_front.StencilPassOp = stencil_op_back.StencilPassOp = D3D10_STENCIL_OP_KEEP; ds_desc.FrontFace = stencil_op_front; ds_desc.BackFace = stencil_op_back; HRESULT hr = idevice->CreateDepthStencilState( &ds_desc, &dx10_ds_state ); if (FAILED(hr)) return; else idevice->OMSetDepthStencilState( dx10_ds_state, 0 ); is this the way of preventing a pixel to be drawn in the screen if the stencil has a value grater than zero??? thanks edit: how can i debug each pixel value in the stencil buffer???

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!