I'm rendering simple 2D figures in DirectX 11.1 and I cannot get Z-values to be rendered; all pixels with Z != 0 get discarded. I'm doing proper world transform as far as I know. X/Y translations work. Rotation over Z works.
Do I need to setup a depth/stencil buffer to avoid DirectX to discard all primitives with Z coordinates?
Thanks, I'll supply any additional information ,code or screens if required.
EDIT:
I've fixed D3D11_VIEWPORT minDepth and MaxDepth members to 0.0/1.0 (I was clearing both to zero). Now pixels with 1.0 < z < 0.0 are discarded.
EDIT 2:
My platform is Windows Runtime App (Win8.1 / WinPhone 8.1).
EDIT 3:
Example screenshots.
Rotated triangle over the Y-axis (pixels with Z>1 discarded)
Triangle Vertex at (x=-0.5,y=-0.5) with z=2. Clipped and hidden.
DepthStencilState
and try introducing a depth buffer, to see if things change. You can easily construct a DSS with default parameters by using theCD3D11DEPTH_STENCIL_DESC
helper constructed with anCD3D11_DEFAULT{}
argument. \$\endgroup\$