Jump to content
  • Advertisement
Sign in to follow this  
Endemoniada

Setting Depth Buffer Values

This topic is 2521 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 guys, please take a look at the image below. I want to set the purple area to z=0 and the green area to z=1, then render like normal. I was thinking I could call Clear() with z=0 then render a quad for the green area and set the z=1 values that way, I need to specify the green area in world coordinates (at a specific world z) so I don't know how I would do that.

Any help would be appreciated. Thank you.

zbuffer.jpg

Share this post


Link to post
Share on other sites
Advertisement
If it's always a rectangle you could just transform your world coordinates to screen coordinates on the CPU, and use Clear() to clear that rectangle.

Otherwise you'll probably want to create a pixel shader that simply writes 1.0 out to the DEPTH semantic (it may need to write a colour too, but you can easily disable colour writes with D3DRS_COLORWRITEENABLE).

Depending on the result you're trying to achieve, you may be able to do the same thing with the stencil buffer, which doesn't need a special shader.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!