Z-buffer

Started by
1 comment, last by Zoot 21 years, 6 months ago
http://217.208.77.195/eh.jpg Something is wrong, but what? Here is my init code: D3DDISPLAYMODE d3ddm; if( FAILED( g_pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ) ) ) return false; D3DPRESENT_PARAMETERS d3dpp; ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3ddm.Format = D3DFMT_R5G6B5; d3ddm.Width = width; d3ddm.Height = height; d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.BackBufferCount = 1; d3dpp.BackBufferWidth = d3ddm.Width; d3dpp.BackBufferHeight = d3ddm.Height; d3dpp.hDeviceWindow = hWnd; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; if( FAILED( g_pD3D->CreateDevice( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, hWnd, D3DCREATE_HARDWARE_VERTEXPROCESSING, &d3dpp, &g_pD3DDevice))) { return false; } g_pD3DDevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CCW); g_pD3DDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID); g_pD3DDevice->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE); g_pD3DDevice->SetRenderState( D3DRS_DITHERENABLE, TRUE ); g_pD3DDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); g_pD3DDevice->SetRenderState( D3DRS_AMBIENT, 0xF0202020); g_pD3DDevice->SetRenderState( D3DRS_LIGHTING, FALSE); [edited by - Zoot on October 20, 2002 3:08:20 PM]
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Advertisement
So what''s the problem? - some pixels being drawn in the wrong Z order ?

Try decreasing the value of the far clip plane or increasing the value of the near clip plane used to build your projection matrix. Z buffers aren''t linear - 90% of their precision is in the first 10% of the distance between the near and far clip planes!.

A temporary fix would be to change the Z buffer depth from D16 to something higher like D24 (depending on whether your hardware supports it with your backbuffer mode...)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

It works! I love you! Thanks!
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!

This topic is closed to new replies.

Advertisement