[D3D11] Depth buffer does nothing

Started by
30 comments, last by 360GAMZ 12 years, 4 months ago
Had same problem here while following Rastertek tutorials. I was blaming myself, and was totally lost on why depth buffer wasn't working.

In the end the problem was the same as OP's:


D3D11_VIEWPORT viewport;
...
viewport.MaxDepth = 0.0f;


Changed MaxDepth to 1.0f and voilá!

Thanks a lot from 1 year in the future smasherprog (and everyone else!)
Advertisement
I came across this post because I'm having similar problems where calling ClearDepthStencilView is clearing my depth buffer to 0 instead of 1. I'll try setting up the viewport to see if it fixes the problem, but one thing that's confusing is this statement from the DX11 ClearDepthStencilView docs:
"Unlike Direct3D 9, the full extent of the resource view is always cleared. Viewport and scissor settings are not applied."
Is this confusing or am I missing something? Are only the min/max depth values used from the viewport but not the other 4 values?

This topic is closed to new replies.

Advertisement