Changing Depth Buffer Write Access (Direct3D 9)

By default, the Direct3D system is allowed to write to the depth buffer. Most applications leave writing to the depth buffer enabled, but you can achieve some special effects by not allowing the Direct3D system to write to the depth buffer.

You can disable depth buffer writes in C++ by calling the IDirect3DDevice9::SetRenderState method with the State parameter set to D3DRS_ZWRITEENABLE and the Value parameter set to 0.

Depth Buffers