XNA CullMode and DepthBuffer
Quick question.
Ive set up a qube out of 8 vertices and 36 indices using DrawUserIndexedPrimitives();
I appears fine if i turn on ClockWise CullMode. But if i set it to None its as i can see the backside of some of the vertices through the qube. Ive set the indices so that they are clockwise. I clear the depth buffer with ClearOptions.DepthBuffer before each frame is drawn.
Can someone englighten me? I cant remember to have had this problem either in Managed DX.
Shouldnt clearing the depthbuffer sort this, even with CullMode set to None, so that vertices that are further away is hidden behind closer objects etc.
Thank you for any reply.
edit:
Can my effect file play any part?
Have you enabled z-writes and z-culling? You should have the effect states set like this:
[Edited by - MJP on July 2, 2008 8:24:47 AM]
ZWriteEnable = true;ZEnable = true;
[Edited by - MJP on July 2, 2008 8:24:47 AM]
Providing it doesn't do anything really crazy, your effect shouldn't have much to do with this. Like MJP said, make sure your ZBuffer is enabled first. If that's set up correctly, another common cause for this behavior is using 0.0f for the near clipping plane of your projection matrix. If that's the case, try changing it to 1.0f (or as big a number that works for you) to fix it.
For more information, this article would be a good read.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement