Jump to content
  • Advertisement

Archived

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

Ikland

Y won't my depth buffer work? (DX8)

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'd really like to know what I am doing wrong here. I am drawing some 3d Objects using DirectX 8, but I can't get my depth buffer to work so that the objects appear correctly. Currently when I am drawing, the most recent objects get drawn in the front, the oldest, at the back... regardless of which is closer to the camera... a sure sign that the depth buffering is failing, as far as I am concerned. These are the settings I am using to set up Depth buffering - d3dpp.SwapEffect = D3DSWAPEFFECT_COPY_VSYNC; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; hr=g_D3D->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL g_main_window, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &g_d3d_device); These are the settings I using to turn Depth Buffering on - g_d3d_device->SetRenderState( D3DRS_ZENABLE, TRUE ); g_d3d_device->SetRenderState( D3DRS_ZWRITEENABLE, TRUE ); I am also using Textures, Alpha Blending, Mip Mapping and a standard Vertex Shader setting, e.g. - g_d3d_device->SetVertexShader(D3D8T_CUSTOMVERTEX); None of which I could see would have any effect on depth buffering not working. I am running a GeForce2 MX card, which I am sure supports Depth Buffering, so what else could be the problem? Can anyone throw a few suggestions my way, as I am at the end of my tether with this one... I can't see what else might be causing the problem! Many thanks, Ikland Edited by - Ikland on February 12, 2001 12:10:56 AM

Share this post


Link to post
Share on other sites
Advertisement
Yeah, thanks for the suggestion... but I did that...

g_d3d_device->Clear( 0, NULL, D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER , D3DCOLOR_XRGB(0,0,0), 1.0f, 0 );

Any other ideas?

Ik

Share this post


Link to post
Share on other sites
Just recently I''ve been asked how I solved this problem, so I''ve made an update to this thread.

It was some time ago now, but I do recall that the problem was due to the scale I was using on the Z-Buffer. I think the scale was too low, so I started using larger numbers to indicate depth... or it may have been the other way around. Whichever way it was, there was not enough distinction between each objects depth, so the Z-Buffer wasn''t able to do much.

Therefore, if anyone else experiences this problem, try changing the scale of the Z-Buffer, it just may be what is required.

Ikky.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!