thelionking at September 24th, 2003 20:54 — #1
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?
anubis at September 24th, 2003 22:59 — #2
hmm, depth-buffer enabled ?
setup the projection matrix in the right way ?
backface culling enabled ?
thelionking at September 24th, 2003 23:12 — #3
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:
thelionking at September 25th, 2003 11:49 — #4
It was nearest clipping plane ... thanks :lol: !
anubis at September 25th, 2003 11:52 — #5
i was going to tell you just that...