Jump to content
  • Advertisement
Sign in to follow this  
Enrico

Depth Fighting with Blending

This topic is 4052 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

Hi, I am currently working a level loader and renderer for Quake 4. Now some levels in Quake4 have grunge maps applied to a few surfaces. The blending settings are given by a material script. Now I get depth fighting where these grunge maps are (I have marked some spots): Where does this depth fighting come from and what can I do against it? I tried different depth comparison function as well as polygon offset, but nothing helped :-( I am rendering the solid surfaces first, then disable depth writes and activate blending and render the translucent surfaces from back to front. Thanks, Enrico

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by Kazade
Have you tried increasing the near plane?

Tried it now and it only works for the polygons very close to the camera :-/

Share this post


Link to post
Share on other sites
I guess that would make sense as the Z buffer is more precise closer to you. Hmm all I can suggest are the following:

- Increase the near plane a bit more
- Increase the Z-buffer depth to 24 if its not there already
- Try bringing the far plane closer (this wont have as much of an effect as altering the near plane though)

Share this post


Link to post
Share on other sites
Got it working now :-)
works now with a mixture of other near and far plane values and a negative polygon offset :-)

John Carmack is doing something with the depth range and projection matrix in Quake4, I will look into it too. Maybe it works better :-)

Share this post


Link to post
Share on other sites
What I usually do, is to draw everything in different passes. First, all opaque objects, writing to the Zbuffer, then all the blended objects (like those decals) only reading from the Zbuffer, but not writing. When you add more stuff you'll see it gets a bit more tricky, but works perfectly in the end.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!