3d – How to draw an object using the depth buffer, but without writing to it?

Question:

It is required to render an object, and it must take into account the depth buffer (that is, do not overlap near objects and overlap distant objects), but at the same time do not change the values ​​in the depth buffer. Interested in DirectX (10 or 11).

Those. you need the same thing that OpenGL does:

glDepthMask(GL_FALSE);

Answer:

All figured out. You need to use the D3D10_DEPTH_WRITE_MASK_ZERO flag, its name is confusing – it looks like it turns on zero writing mode.

Scroll to Top