Archived

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

Z Buffer Problems

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

Recommended Posts

When I turn off the writing to the zbuffer and turn it back on, it doesn''t work. The zbuffer doesn''t go back to normal after that. Any suggestions? This happened on 3 computers so far. ------------------------ Captured Reality

Share on other sites
Someone please? I need this one.

------------------------
Captured Reality

Share on other sites
You should email nes8bit, he probably knows. Just kidding, is this OpenGL or Direct 3D??? Give some code that you are using.

---
www.crazycrackerz.org

Share on other sites
Direct3D

Not much to the code. It''s just setting the renderstate.

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True

''// Draw Particles Here

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False

------------------------
Captured Reality

Share on other sites
Does pd3dDev->Clear() return ok, or does it by chance give "no z-buffer present"? (And do the z-write render state changes return ok?) What do you mean the z-buff "doesn''t go back to normal"?

Share on other sites
I never looked into that.

After I set the renderstate to no writing to the zbuffer, it doesn''t want to go back. I''m wondering if I have to do something when I create the zbuffer surface or if it''s simply a driver problem. I will look into the zbuffer clears when I get back to my computer.

------------------------
Captured Reality

Share on other sites
Thanks guys for trying to help, but I found out it was a driver problem. I''m still not sure if its a driver problem, but I fixed it. If you ever get this problem, follow the pseudo code.

int i;

i = D3DDev.GetRenderstate(D3DRENDERSTATE_ZWRITEENABLE)
D3DDev.SetRenderstate(D3DRENDERSTATE_ZWRITEENABLE,False)

// Do particle effects here

D3DDev.SetRenderstate(D3DRENDERSTATE_ZWRITEENABLE,i)

it''s a very simple solution

------------------------
Captured Reality

Share on other sites
Uh, nes, that doesn''t look like a driver issue. It''s more of a logic one .

See this:

quote:

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True

''// Draw Particles Here

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False

Basically what your doing is turning on the Zwriting when you are drawing the particles, then turning it off as soon as your done. (You need to do the opposite )

If UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, False''// Draw Particles HereIf UseZBuffer Then Direct3DDevice.SetRenderstate D3DRENDERSTATE_ZWRITEENABLE, True

--TheGoop

Share on other sites
Oh silly me. I didn''t copy the code directly, but it already looks like that. Thanks anyway.

------------------------
Captured Reality