0

I have a problem with rendering 3D on orthographic projection. i have the depth stencil enabled but on rendering, it produces weird cuts in between geometry.

I have tried two different depth stencil states, one with depth disabled (for 2D) and one with depth enabled (for 3D).The 3d one gives weird results.

So how to properly render in 3D in orthographic projection?

Here is an image of the problem:

enter image description here

d.h.
  • 1,206
  • 1
  • 18
  • 33
  • Many things bad can happen in the chain of set up to have a proper depth test, one common mistake, if we exclude that the render states are correct and the depth is properly cleared prior to the draw, is if you use a near plane set to 0.f in the projection. Projection matrix cannot handle an infinitely close near plane ( divide by 0 ). – galop1n Mar 27 '16 at 18:51
  • i have used a near plane of 1.0f and a far plane of 100.0f and i guess that its not a problem. – user3696177 Mar 27 '16 at 19:35

1 Answers1

0

Well after debugging for a long time i found that the problem lied in culling, i had culling disabled, setting the cull mode to D3D11_CULL_BACK made things work the way they should have.

  • because a cube is a convex object, and culling back faces would not compromise the mesh visual. If the depth test/write is done properly, cull none should work just as well, disregarding the fact that culling back faces is a performance improvements on heavy scenes. – galop1n Mar 28 '16 at 17:48