#### Archived

This topic is now archived and is closed to further replies.

# Really Basic Question on Z values

This topic is 5310 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Okay, the default viewport has z-clipping planes at 0.0 and at 1.0. Obviously, I don''t want all of my objects in world space to be limited to z-values between 0 and 1. What transformation is used to expand my z-depth in world space?

##### Share on other sites
Are you using perspective projection?

Syntax:

D3DXMATRIX *D3DXMatrixPerspectiveFovLH(
D3DXMATRIX *pOut,
FLOAT fovY,
FLOAT Aspect,
FLOAT zn, // Z-value of the near view-plane
FLOAT zf // Z-value of the far view-plane
);

Just change zn and zf values.

##### Share on other sites
You''re viewport Z values are different than your World Space Z values. You set the limits with your Projection Matrix, and then they get mapped to the 0 - 1.0 range.

Stay Casual,

Ken
Drunken Hyena

##### Share on other sites
quote:
Original post by DrunkenHyena
You''re viewport Z values are different than your World Space Z values. You set the limits with your Projection Matrix, and then they get mapped to the 0 - 1.0 range.

Right.

So what actually does the mapping?

##### Share on other sites
You set a near and far clipping plane in the projection matrix. This handles the distance to the camera and maps the clipping planes to the z-buffer values between 0.00 and 1.00.
It''s unfortunate that in 3D you have x-y-z for coordinates and that the depth buffer is called the z buffer. Still you shouldn''t mix those two z''s as they are completely different. If you are standing at (0,0,0) and the player turns 90 degrees to the right so he is looking along the x axis then the x distance is used for depth and z is left/right.

##### Share on other sites
Okay, that''s what I was after... the z-buffer and the z-axis location are unrelated. That''s what I needed. Thanks!

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
16
5. 5

• 14
• 29
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631775
• Total Posts
3002275
×