Game Development Community

Fog Not Working. Help Please!

by Michael S · in Torque 3D Beginner · 06/23/2013 (12:31 pm) · 15 replies

Okay, so first things first, I am using this resource: www.garagegames.com/community/resources/view/21379

The resource itself seems to work, but the fog settings don't seem like they are saving properly? Honestly I don't know... I made a video to show you, as its the only way I can really explain this good. So, here is the link: www.youtube.com/watch?v=vOcTgP_WX4E&feature=youtu.be

By the way, it only looks laggy cause I didn't record this with fraps :P

Any help is appreciated, while I can tolerate no fog for a while, I would love to have the fog, just looks so much cooler! By the way, if you happen to read this Paul, thanks for the resource!

#1
06/23/2013 (4:43 pm)
Uhm.... guess we need to really figure out a way to inform people a bit better. This was ALREADY added and made stock in T3D 3.0. So the errors likely came from code that I had to change to get it to work properly in 3.0... Those changes you probably overwrote.

Ron
#2
06/23/2013 (5:10 pm)
I removed that code and its doing the same thing. I was hoping for a good laugh because what I added what was already there, and everything started working once I got rid of that code.. lol
Any ideas?
#3
06/24/2013 (4:25 am)
@Michael - your very welcome. this was something we were needing for the game platform that WinterLeaf is working on. Im happy that it can be of use to you.

that being said, i havent changed it since this was posted and Ron is now the resident fountain of knowledge on it. I believe as Ron said "It was a great start..." *pokes at Ron*
#4
06/24/2013 (8:02 am)
I'm not sure if that part where I said "I was hoping for a good laugh because what I added what was already there, and everything started working once I got rid of that code.." added any confusion as to whether or not I got this working, so to clarify, no its not working yet.

Also, thanks Paul for getting Ron started and replying to my thanks, haha

EDIT: I just noticed now that the ONLY thing not working / saving properly is the fog color. Any clues with that? Not sure how to make this work..
#5
06/24/2013 (11:01 am)
Hello Michael S,

Your problem is probable to be because you are using scatter Sky, which has a fog setting also, that it's going to override all fog settings made in the LevelInfo class property.

So, after you have saved your changes made in the fog properties of the LevelInfoClass and reload your game level, the fog properties of the scatter Sky will override any changes you have been made before.

A solution in this case would be you replace the scatter Sky by Skybox, add a sun, remove flare effect if needed, then just to adjust the lighting of the sun properly. Next check out the fog properties of the LevelInfo class again and save your game level.

Now, after restarting the game level, you will notice that the game level scene will keep the changes you have been made before reloading the level.

Have fun!
#6
06/24/2013 (11:25 am)
Thanks you very much Joao! That solved the issue, can't believe I didn't think of that.. Anyways, thanks again :D
#7
06/24/2013 (11:48 am)
@Michael S,

You are welcome.

I'm glad to hear that everything has worked properly now.

Cheers,
#8
06/24/2013 (2:02 pm)
wow everyone beat me. ScatterSky was overriding your settings. That was my next suggestion. Love this community when it comes to getting answers.

Ron
#9
06/24/2013 (2:20 pm)
Yeah, this community is quite helpful! :D
#10
06/24/2013 (2:52 pm)
It's great that fog now effects the sky ... even though I've just ripped that function out of my own project ... ;)
#11
06/24/2013 (3:18 pm)
Speaking of ScatterSky, fog and settings - was that change ever made to the ScatterSky shader to get fog and ScatterSky to look right together? I mean this one....
#12
06/24/2013 (4:06 pm)
Yes, it's now in stock 3.0 MIT ... so I just had to take it out again for my own project. ;)
#13
06/25/2013 (12:15 am)
Sorry Steve! I basically took a bunch of scattersky community fixes and lumped them all together into a single scattersky fix, If they were in the resources section then chances are they are now stock. I don't think I found a single one that broke any thing.

Ron
#14
06/25/2013 (5:39 am)
@Richard

I use that fix for my project and it works like a charm. It looks awesome with scatter sky and is easy to tweak to make it fit special settings.

Also I use Torque 3D 2.0 MIT for my current project and have so far seen no need to port my project to T3D 3.0 MIT.
#15
06/25/2013 (6:31 am)
And just incase someone does want the old system back ... somebody asked on irc ... eg: if you're using skybox like myself and don't want atmosphere fog, it's a simple 1 line fix from the older version.

In shaders/common/postFX/fogP.hlsl
...
   float depth = prepassUncondition( prepassTex, IN.uv0 ).w;
   //return float4( depth, 0, 0, 0.7 );
   
   clip( 0.9999 - depth );//added to stop fog going into sky - yorks
   
   float factor = computeSceneFog( eyePosWorld,
...

Set "fogAtmosphereHeight" to "0" in your *.mis file and fog will evenly populate objects as before, then tweak the skybox's own "fogBandHeight" setting from 0.1 to 1.0. If you're wanting the higher values then it's probably best to leave the shader alone!