Archived

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

Admire123

Z buffering problem

Recommended Posts

I''m using D3D, when I move my view to very far away ,my object''s surfaces become rendering in wrong order, can any ppl help me to solve it?? below links are the screen shot of the problem orginal model http://home.ent-mart.com:8081/forum/servlet/JiveServlet/download/166-681-3911-285/sc1.jpg close view no problem http://home.ent-mart.com:8081/forum/servlet/JiveServlet/download/166-681-3911-287/sc3.jpg problem arise when zoom out http://home.ent-mart.com:8081/forum/servlet/JiveServlet/download/166-681-3911-286/sc2.jpg http://home.ent-mart.com:8081/forum/servlet/JiveServlet/download/166-681-3911-288/sc4.jpg the compiled program http://home.ent-mart.com:8081/forum/servlet/JiveServlet/download/166-681-3911-290/runtime2.zip is there anything i set wrong?? my view is D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/4, (float)(800/600), 1.0f, 10000.0f ); D3DVIEWPORT8 viewp; viewp.X=0; viewp.Y=0; viewp.Width=800; viewp.Height=600; viewp.MinZ=0.0f; viewp.MaxZ=1.0f; m_pD3DDevice->SetViewport(&viewp); i use CD3DFile from D3DFile.h to draw the object my render setting is m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MINFILTER, D3DTEXF_LINEAR ); m_pd3dDevice->SetTextureStageState( 0, D3DTSS_MAGFILTER, D3DTEXF_LINEAR ); m_pd3dDevice->SetRenderState( D3DRS_DITHERENABLE, FALSE ); m_pd3dDevice->SetRenderState( D3DRS_SPECULARENABLE, FALSE ); m_pd3dDevice->SetRenderState( D3DRS_ZENABLE, TRUE ); m_pd3dDevice->SetRenderState(D3DRS_AMBIENT,D3DCOLOR_COLORVALUE( 0.25, 0.25, 0.25, 1.0 )); m_pd3dDevice->SetRenderState(D3DRS_AMBIENT,RGB(0,0,0)); m_pd3dDevice->SetRenderState(D3DRS_CULLMODE,D3DCULL_NONE ); please help, thx very much Regards Gary

Share this post


Link to post
Share on other sites
Well, even if it works with a 24 bits Z buffer, it may be a good idea to make it works with a 16 bits one in case your user wants to use 16 bits color depth.

You should try to either decrease your far plane value or increase your near plane value. I''d recommand the latest.

Share this post


Link to post
Share on other sites