3D smoke artifacts (fixed)

Hey OpenGL gurus!

I’m a OpenGL-n00b and have a little problem with 3D-smoke. I have billboards with 32bit textures, all z-sorted ofcourse. Now the problem seems to be that when the billboards are very near to each-other, the blending gets messed up.

The following screenshot illustrates the problem:

http://home.hccnet.nl/s.balk/mmorpg_clouds_artifacts.jpg

I’ve done some drawing on it so explain what’s happening.

I’ve played a lot of FPS-games, that use 3D-smoke where these artifacts are not occuring, so it is probably my fault :slight_smile:

If you have enabled the z buffer (seems like you have, since you sort the smoke plates), the problem is probably a classical z-fighting issue. Try moving the near clipping plane away from the camera or the far plane closer, and see if it helps. What are they at now?

  • elias

Ah, that makes me think about the z-buffer… (doh) it has a presicion of only 24 bits… (ATi-card)

Settings were: near 0.001F / far 8192.0F

Narrowing them solved it! Thx!

  1. If you’ve already z-sorted your particles, then a z-buffer is unnessisary. Turn it off to avoid z-fighting.

  2. 24-bit z-buffer is more than enough for most apps. Remember that a z-buffer is non-linear and that most acuracy is near the camera, therefore increasing the near plane has a dramatic effect (likewise, the far plane distance has a minimal distance). A near of 0.001f is overkill for practically every game. Push it as far out as possible.

[quote]1. If you’ve already z-sorted your particles, then a z-buffer is unnessisary. Turn it off to avoid z-fighting.
[/quote]
Hm, interesting. You see I’m a n00b here. Now I enable it for the terrain and disable it for the smoke. For this kind of smoke it turns out it doesn’t matter at all whether I z-sort them or not (who cares which grey cloud is rendered first if they are all the same color and blended). For other kinds of particle-engines or 3d-blended objects the z-sorting is important so I guess I’ll keep it anyway. The z-sorting isn’t a real performance hit, but disabling the depth-buffer increased performance by 33% when the smoke fills the whole screen. (150fps -> 200fps)

Thanks again for all help. I guess I have to read that Redbook someday before doing anything serious in OpenGL.