Game Development Community

Torque 3D Beta 1 Bug: fogBandHeight & LevelInfo

by Caylo Gypsyblood · in Torque 3D Professional · 05/16/2009 (4:00 pm) · 9 replies

Inconsistency with fog settings field locations. The fogBandHeight is located in SkyBox object yet all other fog setting are now located in LevelInfo.

Personally when i think to myself, 'I need to tweak the fog settings.' I do not think about looking under the LEVELINFO object, that is not logical at all, it is not even self explanatory! Whats with that? Same with VisibleDistance.

I suggest renaming LevelInfo to "Environment" or something more logical to help describe what fields it holds.

#1
05/16/2009 (4:59 pm)
"FogBandHeight" used to be called the "RenderBandOffsetHeight" in TGE/A. It's always been in the skybox, as it's how far the fog bleeds up into the skybox.
As for fog settings being in LevelInfo ... uhm ... no real opinion. The fog isn't actually part of the sky.

Also I think that fog is now exponential rather than culling, which is somewhat of a change from TGE/A - just an observance based on old Q3+ style parameters.
#2
05/16/2009 (5:38 pm)
I dont mind where the settings finally end up, as long as the object naming system is logical.

I recall reading about 8 days or so ago, that fog is busted or something to that effect- not working correctly yet.

Also the fact one cannot set fog distance with any Torque Unit accuracy is a bleeding pain, one more incongruity with Torques logical systems; why have everything working under separate logic/naming/definition rules? If T3D were a religion it would be full of contradictions and logic traps. Its early enough to solve them without disruption.

EDIT: FogDensityOffset was bugged first time editing settings. After restarting T3D and loading the mission edition the FogDensityOffset had expected results, so its not "Also the fact one cannot set fog distance with any Torque Unit accuracy is a bleeding pain" a fact, but bug probably already known.
#3
05/18/2009 (3:09 pm)
Quote:I suggest renaming LevelInfo to "Environment"
That is a reasonable idea... i don't like LevelInfo either, but it is what its called in Unreal and similar to what Torque has had in the past.

Quote:Also the fact one cannot set fog distance with any Torque Unit accuracy is a bleeding pain
During the rewrite of the renderer i changed it to use a fog density values which is how Crysis and Unity do fog. That said while its mathematically more correct i think its shown itself to be much harder to use. I'll see about changing it back to distance fog (like Source/Unreal) while retaining the same functionality.

#4
05/18/2009 (3:10 pm)
@Caylo - If you do see a bug please let us know some recreation steps.
#5
05/18/2009 (3:45 pm)
Quote:
I suggest renaming LevelInfo to "Environment"
A separate "Environment Info" object would be better.
#6
05/18/2009 (4:16 pm)
@Tom: Going by memory here, but i think the bug i was having is already known (or related to the known fog bugs), and even mentioned in "Known Issues" thread. I will wait to see if i can recreate it in beta2; then make the bug report (beta 2 is really soon now/this week isn't it?).

Also, I like to modify the fog distance settings by script(and c'code modification) for 'mood', like bring it in close and make it dark for creepy parts of the level, open up the view after a winding path in the woods- stuff like that. As long as the density of the fog is consistent when the 'Offset' is truly all that matters.
As it is now, change the distance offset and one must also reconfigure the density, and i cant find any mathematical ratio of the two settings that works consistently.

#7
05/18/2009 (5:12 pm)
You can see the fog calculation in shader/common/torque.hlsl
float computeSceneFog(  float3 startPos,
                        float3 endPos,
                        float fogDensity,
                        float fogDensityOffset,
                        float fogHeightFalloff )
{      
   float f = length( startPos - endPos ) - fogDensityOffset;
   
   float h = 1.0 - ( endPos.z * fogHeightFalloff );  

   return exp( -fogDensity * f * h );  
}

So its basically the negative part of the exponential curve.

It looks to me like offset and density are working properly. If I set the fog density to something relatively thick, like 0.05. And then change the fogOffset between 0 and its default value of 10, it affects the fog density within 10 meters of me but not the density of fog on more distant things.

I have however seen things get really weird and backwards if you try setting the atmosphereHeight to a very small number. This seems to totally break the fogging calculation.
#8
05/18/2009 (5:54 pm)
Im still not sure im understanding this new FOG right. Im custom to thinking START distance(from viewer). But I set a start distance and density, later changing the start distance effects the density. It seems the fogDensity is not consistent.

I will continue to fiddle with it, and see what i get. Knowing where the FOG is getting its rules/math will help me considerably to know if its my funny logic or something strange with the fog.



But do please be sure the fogBandHeight gets moved into the object who have all the rest of the FOG settings...


EDIT: Never mind, after 5 minuets of posting this, i find it is indeed a bug. Ill post a bug report as soon as i figure out the details.


#9
05/19/2009 (12:35 am)
Ok, once more i was wrong, but sorta right also. The bug i thought i was having was not a bug, but i did find another bug when trying to find the bug that was not a bug. And im still not done debugging the second real bug i found, so it bugs me that i can not make a good bug report about it yet.

The first bug was from my video card overheating, turns out i had a bunch of 'computer gremlin' hair (ok, just a bunch of dust, but i swear i got computer gremlins! Someday i will have proof that they exist!) stuck in my video card heat sink. The video card was causing all types of strange behavior, and would never have been a suspect as only T3D tax the hardware to that extrema (and i was working with fog settings when i first took notice).
To the point, T3D overheating the video card, especially Nvidia's in this case, can cause the hardware to automatically down clock in effort to cool itself, a documented safety feature from the Geforce2 days. I retested this hypothesis by 'removing' the heatsink fan altogether(dont fret, i have replacement parts) and had the same erratic behavior, this time from anything 3D related.
Something to consider when most peculiar behavior are reported as bugs for T3D. Could also be sign that something bad is afoot with the shaders.

The real bug is indeed with fog, but I can not make it happen consistently. At some point none of the fog settings will take effect, or the fog settings such as fogOffset of 50 will act as if its fogOffset of 5. Seems to happen after T3D have run for a long time, set fog settings, move to other things, come back to fog, ect... No real easy to repeat pattern.