Game Development for Xbox 360, PC + Windows Phone 7

3D Objects Drawn are missing faces.

rated by 0 users
Answered (Verified) This post has 1 verified answer | 1 Reply | 2 Followers

Top 25 Contributor
3 Posts
slooksterpsv posted on 9 Mar 2010 3:31 AM

Any 3d objects I draw are always missing faces - e.g. not every face is drawn. If I move the camera it draws some then removes them again, if any objects are in front or behind, it's almost like it can't tell which to draw first so even if an object is further, it's may have pieces drawn in front of others. I'm not sure what I've done, but it's been happening since the Astroid models were added.

 

Answered (Verified) Verified Answer

Top 10 Contributor
Male
136 Posts

If you have any 2D as well as 3D then make sure the following render states are set before displaying the 3D object.

GraphicsDevice.RenderState.DepthBufferEnable = true;
GraphicsDevice.RenderState.AlphaBlendEnable = false;
GraphicsDevice.RenderState.AlphaTestEnable = false;
GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Wrap;
GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Wrap;

If there isn't any 2D in your demo then check your near and far planes

Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio,
1.0f, 10000.0f, out projection);

If your near plane is below 1.0 then change it to 1.0.

The last thing is to make sure your culling is set correctly (CullCounterClockwiseFace).

If your problem isn't due to any of those let me know.

Thanks,

Chad

Page 1 of 1 (2 items) | RSS
© 2011 Chad Carter. All rights reserved.