Making my object have a Z > 1

ThePentiumGuy

Senior Contributor
Joined
May 21, 2003
Messages
1,113
Location
Boston, Massachusetts
Hey,
I'm trying to create a skybox.

In my game, my meshes render just fine. But when I create a skybox (6 textured quads) nothing appears. -

So I tried messing around with quads(loading textures onto vertex buffers and rendering).

When I render my quad at 0,0,1 it appers fine. But when I render my quat at 0,0, 1.000001, it dissappears (a little exxaguration, but you know what I mean, any Z > 1, it disappears)

Yes, I'm clearing my ZBuffer, and Yes, i'm setting a ZDepth of 1
D3Ddev.Clear(ClearFlags.Target Or ClearFlags.ZBuffer, Color.FromArgb(0, 0, 225), 1.0, 0)

(1.0 is the max it can go).

So I thought it had to do with the Projection matrix.
When i set up the projection matrix:

D3Ddev.Transform.Projection = Matrix.PerspectiveFovLH(System.Convert.ToSingle(Math.PI) / 4, mDisplaymode.Width / mDisplaymode.Height, 1.0F, 1000.0F)

the object disappears altogether! even when the Z is set to 1.

Does anyone know how to fix these problems? All i want to do is use that same projection matrix, and a matrix LookAtLH to render my meshes as well as quads. For some reason any quad with a Z > 1 disappears.


Thanks

Pent

edit: Just to clarify:

My object is centered (by default) at 0,0,0.
Its height,depth,and width are 512. so the backleft coordinate is (-256,-256,-256), its far right coordinate is (256,256,256)

My World is set to Identity.

My View is set to:
D3Ddev.Transform.View = Matrix.LookAtLH(new Vector3(0,0,0), New Vector3(0, 0, 1), New Vector3(0, 1, 0))

My Projection is set to:
D3Ddev.Transform.Projection = Microsoft.DirectX.Matrix.PerspectiveFovLH(CSng(Math.PI) / 4, 800.0F / 600.0F, 0.0F, 300.0F)

I created my own class (using CustomVertex.PositionTextured)

I turned Culling and I can't see my box :).
 
Last edited:
Back
Top