Jump to content
  • Advertisement
Sign in to follow this  
Salgar

Basic Textured Cube Culling Problem

This topic is 4429 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

Hi there, I have just started learning Directx programming and i'm having a problem, I am currently just trying to make a 3d cube, but however i make the cube, the culling is always done wrong on the cube, I can always see the wrong sides of the cube, eg. I can see the last drawn side of the cube insted of seeing only what i am supposed to be able to see. I have also tried a cube mesh with normals specified and having a light on the scene, but depending on which way the light is facing, one of the faces is always missing and hence showing the inside of the cube. I'm not sure if there is something wrong with my mesh, but all the normals on the verts face outwards, and i have tried all of the renderstate culling options. If anyone could help it would be great. Thanks Paul Robinson

Share this post


Link to post
Share on other sites
Advertisement
Vertex normals only affect the lighting calculations - they have nothing to do with whether or not the face is culled. Backface culling depends on the winding order of the vertices comprising the triangle. Perhaps you've got this wrong?

Simplify things to narrow down the problem. Disable lighting, disable culling, change Draw*Primitive to only draw a single face of your cube. Ensure that single face is drawn correctly before moving on to the next face or before you begin turning on features like lighting, texturing, and culling.

Share this post


Link to post
Share on other sites
If this is your very first D3D program, then you might have forgotten to allocate a Z (depth) buffer. Or forgotten to turn on depth testing. Or forgotten to turn on depth writes.

An alternative is that the model you're using is intended for a different culling order than you're using -- CW instead of CCW for example.

Share this post


Link to post
Share on other sites
Hey everyone, thanks for the replys, it was the zbuffer/depth buffer problem that i had forgotten to turn on.

Thanks for the helps :)

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!