Jump to content
  • Advertisement
Sign in to follow this  
shaKu_shawn

EnableAutoDepthStencil = true makes my model dissapear

This topic is 3919 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

I am rendering a model to the screen... everything looks good except the back polys are showing through a little bit... so I turned presentParams.EnableAutoDepthStencil = true; (it was false before) and now I dont see my model at all... if I switch it back to false I can see my model again... can anyone tell me what this symptom means?

Share this post


Link to post
Share on other sites
Advertisement
If all your draw calls are succeeding, then this means that by the time your model gets rendered, the z-buffer says there's something in front of it. This could be caused by a few different things, but I'm willing to bet that you're either failing to clear the z-buffer before each frame, or are clearing it to a bad value.

Show us your call to IDirect3DDevice9::Clear. It should go something like this:

device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, clear_colour, 1.0f, 0);

Clearing z to 0 will prevent anything from getting draw in front of it, (under the <= comparison function).

Admiral

Share this post


Link to post
Share on other sites
ok great that was my problem... in my clear call i left out the flag to clear ZBuffer... but now I have a new problem! I was rendering to a surface using

m_device.SetRenderTarget(0, renderTexture.GetSurfaceLevel(0));

just before my clear call and all was just fine. Now with the EnableAUtoDepthStencil set to true and the ClearFlags.ZBuffer added to my clear call all I get returned is a black image (as if the surface is never drawn to) when at the very least I should get a SteelBlue image since that is the color I am clearing... any suggestions?

NOTE: If I remove this render target call and have it draw directly to a form everything looks just right....

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!