Game Development Community

Fog still not working properly

by Richard Marrevee · in Torque 3D Professional · 09/29/2009 (4:37 pm) · 6 replies

Some time ago I started this thread

www.garagegames.com/community/forums/viewthread/98059

We are now in 1.0 but still have the same problems: no fog over the leaves of the trees.

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
09/29/2009 (8:59 pm)
Yea... i dropped the ball on that one.

Try this fix.

In materials/processedShaderMaterial.cpp around line 270 in function ProcessedShaderMaterial::_determineFeatures()...

if ( mMaterial->mColorMultiply[stageNum].alpha > 0 )
      fd.features.addFeature( MFT_ColorMultiply );

   if ( lastStage && 
         ( !gClientSceneGraph->usePostEffectFog() || // CHANGED!
           fd.features.hasFeature( MFT_IsTranslucent ) ) ) // CHANGED!
      fd.features.addFeature( MFT_Fog );

   if ( mMaterial->mMinnaertConstant[stageNum] > 0.0f )
      fd.features.addFeature( MFT_MinnaertShading );

That sould fix it.
#2
09/30/2009 (8:33 am)
I am rather busy right now, but as soon as I have some spare time I will give it a try. Thanks Tom.

Edit: It worked Tom. I only had to turn of transparent Z-write at the material of the leaves. Thanks again.
#3
09/30/2009 (11:20 pm)
Tom,
Had the same issue with a number of different models using transparency on the leaves. Applied the fix you mention above.
Also turned off transparent z-write and still no joy.



#4
10/01/2009 (6:53 am)
@David:

I also changed this in the material file

alphaTest = true;  // default value
   alphaRef = 120;   // alpha less than 128 in brightness (255 is max) will not be rendered

or you can change it in the material editor.


#5
10/01/2009 (7:54 am)
ok...Also needed to make the transparency type to "none" I was using Sub which was quite nice with double sidedness but once I went to none all was fine. (Though with trees I can't go dou

So it seems alpha-blending isn't a go for leaves
#6
10/01/2009 (5:34 pm)
@David - You could use alpha blending for leaves, but you won't get shadows.

In an upcoming version of T3D... 1.2 i think.... we plan to implement a brand new technique that will allow alpha blending with shadows for at least 3 layers of transparency.