models hiding other models

Started by
2 comments, last by mihaimoldovan 12 years ago
I have a problem in which the models I draw keep hiding other models, not in a 3d way but in a sprite kind of way.
Its weird and annoying, is there a way to fix it?

Advertisement
A description of the problem or an image would help.
Guessing blindly, I would suggest enabling alpha testing and/or depth testing.


L. Spiro

I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid

Ye, it is probably a depth buffer problem. If you do not enable the depth buffer, things will get drawn in the order which they were added to Components, and NOT on their order in 3d space.

Set
GraphicsDevice.DepthStencilState = DepthStencilState.Default; at the start of your draw method.
If it's a depth issue, you may want to look into:

- Painter's Algorithm: Sort from back to front, draw in that order.
- Depth Buffering: Discard pixels that would be behind what's already drawn.

If you want to know how to implement occlusion culling:

- Occlusion Queries (Z-Buffer hierarchy is a good optimization)
- Precomputed PVS and portals

This topic is closed to new replies.

Advertisement