Jump to content
  • Advertisement
Sign in to follow this  
KazumaID

Render order?

This topic is 3873 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've been programing a little chess game, just to get used to programing games. Nothing really formal, just placing the pieces on the board, movements, and anything else i think about. Right now I just finished placing all the pieces on the board, but some pieces show ontop of others that positionally should be in front. for example, a pawn is drawing itself ontop of the my tower, although the tower is closer to the camera. I suppose that the problem would be my models, not too good with them yet :( Example: http://manny33.googlepages.com/chess.png project is in XNA.

Share this post


Link to post
Share on other sites
Advertisement
You have to enable what's known as z-culling, or z-buffering. The idea is that for each pixel you render to the screen, you store the z-value of that pixel (AKA how far the pixel is from the camera). Then the common thing to do is whenever you render another pixel to that same spot, you compare z-values and keep the pixel that's closer to the camera. Unfortunately I don't know how to enable this in XNA, but it's probably similar to D3D9 where you have to enable both Z-writes and Z-culling separately.

Share this post


Link to post
Share on other sites
I tracked down the Z-Buffer and Z-Writer to these two XNA properties:
RenderState.DepthBufferEnable
And
RenderState.DepthBufferWriteEnable

I've set them both to true, but I get the same results.
Do i need to set some type of value for this to work?
specify the Z-index of a model or something like that

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!