XNA Essentials

Game Programming for Xbox 360, PC + Windows Phone

NAVIGATION - SEARCH

3D Objects Drawn are missing faces.

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.


 

slooksterpsv - Tuesday, March 9, 2010 @ 3:31 AM

Re: 3D Objects Drawn are missing faces.

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

Chad Carter - Tuesday, March 9, 2010 @ 1:58 PM