parallel projection z-buffer problem.
When using parallel projection, objects that are farther away get rendered on top of objects closer to the camera (the last one drawn gets on top). This problem only occurs when using this projection and not in perspective projection. Does anyone have any advice?
How did you set your parallel/orthographic projection matrix ?
Is it W friendly ?
Is it ensuring that clip space Z and W are in the correct range ?
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
Is it W friendly ?
Is it ensuring that clip space Z and W are in the correct range ?
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
D3DXMATRIX matProjx(
0.025f, 0, 0, 0,
0, 0.025f, 0, 0,
0, 0, 0, 0,
0, 0, 1, 1.0f);
m_pD3DDevice->SetTransform(D3DTS_PROJECTION, &matProjx);
I don''t know what W friendly is (3d newbie). :/
Ah - no Z output and no Z range. Use D3DXMatrixOrthoLH or the following matrix (which is exactly what it generates):
2/w 0 0 00 2/h 0 00 0 1/(zf-zf) 00 0 zn/(zn-zf) 1
w & h = width & height of surface, you can use your 0.025 if you want - they just affect how x and y get scaled.
The important parts though are specifying the minimum and maximum Z values *in camera space* used for clipping AND the Z buffer. zn is the near clipping plane, zf is the far clipping plane. Feed in the same values you do for your perspective. Remember not to set zn or zf to 0.
[See the other recent post on exactly what the values mean - titled something like "FOV"]
--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement