Basic Textured Cube Culling Problem

Started by
3 comments, last by Salgar 17 years, 9 months ago
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
Advertisement
Could be a depth buffering issue.

How have you configured your depth/stencil buffer and your projection matrix?

Cheers,
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

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.

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.
enum Bool { True, False, FileNotFound };
Hey everyone, thanks for the replys, it was the zbuffer/depth buffer problem that i had forgotten to turn on.

Thanks for the helps :)

This topic is closed to new replies.

Advertisement