0
101 Sep 25, 2003 at 00:54

Hi,

I have simple drawn a 3d Triangle or a pyramid with four faces. There order is

1 - Front Face
2 - Left Face
3- Back Face
4- Right Face

Pyramid is drawn right … my problem is I can see through it. After ananlyzing it I came to the following observations :

• Through 1 I can see 2, 3 & 4.
• Through 2, I can see 3 & 4.
• Through 3 I can see only 4.
• And nothing can be seen through 4.

How come I am seeing through surfaces.
There is something I am missing, right?

#### 4 Replies

0
101 Sep 25, 2003 at 02:59

hmm, depth-buffer enabled ?
setup the projection matrix in the right way ?
backface culling enabled ?

0
101 Sep 25, 2003 at 03:12

Depth Buffer is enabled, lighting is off and Back Face Culling is off. Here is the code :

Graphics->SetRenderState (D3DRS_LIGHTING, false);    // Set Lights Off
Graphics->SetRenderState (D3DRS_CULLMODE, D3DCULL_NONE); // Do not cull Back Faces
Graphics->SetRenderState (D3DRS_ZENABLE, D3DZB_TRUE);  // Enable Depth Buffering


And for the Projection Matrix :

float AspectRatio = (float)Width / (float)Height; // Ratio between Width & Height

// Initialize Perspective View for the Screen
D3DXMatrixPerspectiveFovLH (&Projection, // Projection Matrix
1.0f,    // Field of View
AspectRatio, // Aspect Ratio of the Screen
0.0f,    // Nearest Clipping Plane
100.0f);   // Farthest Clipping Plane

// Setup Projection Matrix for the Screen
Graphics->SetTransform (D3DTS_PROJECTION, &Projection);


Is there anything to do with nearest clipping plane or the Field Of View? :sigh:

0
101 Sep 25, 2003 at 15:49

It was nearest clipping plane … thanks :lol: !

0
101 Sep 25, 2003 at 15:52

i was going to tell you just that…