Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I've got an application written in D3D9 which will not write any values to the depth buffer, resulting in incorrect values for the depth test. Things I've checked so far:

  • D3DRS_ZENABLE, set to TRUE
  • D3DRS_ZWRITEENABLE, set to TRUE
  • D3DRS_ZFUNC, set to D3DCMP_LESSEQUAL
  • The depth buffer is definitely bound to the pipeline at the relevant time
  • The depth buffer was correctly cleared before use.

I've used PIX to confirm that all of these things occurred as expected. For example, if I clear the depth buffer to 0 instead of 1, then correctly nothing is drawn, and PIX confirms that all the pixels failed the depth test. But I've also used PIX to confirm that my submitted geometry does not write to the depth buffer and so is not correctly rendered.

Any other suggestions?

share|improve this question
add comment

2 Answers

Make sure that your depth buffer is set up correctly in your present parameters. Check the depth range specified in your viewport.

share|improve this answer
add comment
up vote 0 down vote accepted

Turns out that I didn't set the projection matrix in the fixed function pipeline- not something I thought was necessary when using a shader.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.