Game Development Community

Fog not working properly

by Richard Marrevee · in Torque 3D Professional · 07/27/2009 (12:48 am) · 8 replies

I am trying to add some fog to a level, but the trees and foliage are not "fogged" as you can see in the next images.

games.marrevee.com/images/fog1.jpgThis one is from a distance.

games.marrevee.com/images/fog2.jpgThis one is taken a little closer.

As you can see are the trunks in the fog, but not the leaves. Also is the bush left of the trees not fogged. The trees and bushes are from the sticks & twigs package. The bus is placed with fxShapeReplicator and the trees are TSStatic objects (both are dts).

Is this a problem in the dts files or with the material applied to it? I have tried different settings in the materialeditor but no luck. Or is it my videocard (NVidia Geforce 8400).

I am stuck here and this level needs fog very badly.

In advance thanks.

About the author

Started programming in 1984 on an Oric, when time progressed switched to MSX, Amiga and finally the Windows PC with T3D. Now developing an epic fantasy game: The Master's Eye. Creator of the DoorClass pack and VolumetricFog pack @ richardsgamestudio.com


#1
07/27/2009 (1:17 am)
Yeah, I've seen this happen too. I haven't posted a bug on it yet, but I noticed that the precipitation doesn't fall in front of my trees, only above them and behind them. I gotta get that video of it - it's really trippy when you pay attention to it.

Unfortunately, I don't have a bug fix for yours, but can only concur with your finding.
#2
07/27/2009 (6:51 am)
Quote:
precipitation doesn't fall in front of my trees, only above them and behind them
Z sorting issue with transparencies?
#3
07/27/2009 (7:43 am)
Right now the fog is entirely done via a post processing effect. It depends on the depth value written during the prepass. Alpha-blended objects without translucent z-write enabled don't write to the depth buffer, so they cannot be fogged by it. Alpha-blended materials need to know how to fog themselves, and they don't do it yet.

Anyway, even if it is a missing feature, you should *not* be using pure alpha-blended materials for tree foliage. You need alpha-test, z-write enabled, or you're in for high performance drops if you have too many trees and or too many lights. And since alpha-blended objects don't write their depth to the prepass, a lot of post processing effects won't work properly on them, so you'll hit graphical glitches sooner or later by using too many of them.
#4
07/27/2009 (8:20 am)
@Manoel - yeah, but it would be nice if fogging and shadows worked on alpha blended items anyway. Completely eschewing the use of alpha blending in order to get fogging or shadows seems like a bad compromise.
#5
07/27/2009 (9:13 am)
Yeah, it needs to work, after all there *are* certain materials that require blending (unlike foliage), like glass and translucent plastic but be aware that it will never work to the same level as opaque geometry and will always have a much higher performance hit.
#6
07/27/2009 (1:55 pm)
Yeah, my hope is that it doesn't get forgotten or pushed off for later. The problem isn't just for glass materials (etc), but for things where you need to use LerpAlpha also. Can you imagine having someone's hair either not alpha blended, or worse, glowing in the fog?
#7
07/27/2009 (4:05 pm)
I'm pretty sure i know what that is. Its not fogging the translucent objects because they don't have depth in the prepass. It will be fixed for 1.0.
#8
07/30/2009 (12:04 am)
Then we have to wait for 1.0, so this thread is closed I think.

Thanks.