Volumetric Fog
by Seth Willits · in Torque Game Engine · 11/12/2004 (4:09 pm) · 16 replies
Does Torque support volumetric fog? Opening up the FPS demo, you can see that far away hills have fog on them, but the skies above them are crystal clear rather than foggy. It's a very odd appearance.
About the author
http://www.sethwillits.com/
#2


The first one looks fine, about what I'd expect. The second one however, doesn't. The hill way in the background to the left just looks like a big piece of cardboard sticking up, and the closer hill looks strange as well.
11/13/2004 (8:21 am)
Well take a look at these shots from the FPS starter kit:

The first one looks fine, about what I'd expect. The second one however, doesn't. The hill way in the background to the left just looks like a big piece of cardboard sticking up, and the closer hill looks strange as well.
#3
there's other tricks then, like dynamically changing the fog color based on what direction the player is facing...I haven't done that myself but I've heard that it works pretty good also.
11/13/2004 (8:46 am)
That is the way that distance based fog works in computer graphics. One trick I like to do is take my skybox in some paint program, or take a screenshot of my game, then sample the color of the sky at the horizon. then set your fog color to be that same color. It works pretty good, but you have to have the same basic horizon color in all directions for it to work perfectly.there's other tricks then, like dynamically changing the fog color based on what direction the player is facing...I haven't done that myself but I've heard that it works pretty good also.
#4
How do you think that the skybox/terrain interactions should look? Should the sky always be fogged up to the height of the highest point on the terrain? Should terrain fade to be "transparent" to the sky?
11/13/2004 (7:21 pm)
You could also tweak the render bans code. Or try changing other settings on the skybox. Thanks for the clarifying screenshots. They make it much easier to have a discussion about this.How do you think that the skybox/terrain interactions should look? Should the sky always be fogged up to the height of the highest point on the terrain? Should terrain fade to be "transparent" to the sky?
#5
Hehe... Alright, so I've been searching google images for real pictures of mountains and fog for about a half an hour and I came across a screenshot that might be a little familiar... it's from Tribes 2!

Fog is in there, looks pretty good, and it blends into the skybox really nicely as well. Although that top of that peak is a little interesting. It's almost as if the fog only works on triangles below where the sky meets the horizon and nothing above it...
11/13/2004 (11:16 pm)
Hmm... looking around it seems that I can't find any screen shots of a game with a real sky (clouds, sun, the whole 9 yards) and fog in a big enough outdoor area. Everything I can find either is big and uses a solid color sky, or small enough that it doesn't use fog at all and has a fancy sky box.Hehe... Alright, so I've been searching google images for real pictures of mountains and fog for about a half an hour and I came across a screenshot that might be a little familiar... it's from Tribes 2!

Fog is in there, looks pretty good, and it blends into the skybox really nicely as well. Although that top of that peak is a little interesting. It's almost as if the fog only works on triangles below where the sky meets the horizon and nothing above it...
#6
11/14/2004 (12:09 am)
Thats pretty true to real life though. Back where I come from, I used to sit outside and watch the fog lay flat over the lakes and would often see things poking out of the top. I guess thats why they call it a blanket. Don't know
#7
11/14/2004 (6:20 am)
Seth, the picture which you describe as "sticking out like cardboard" is because your visible distance (in the Sky section of Mission Editor) is higher than the Fog distance (same place iirc)
#8
11/14/2004 (9:38 am)
Torque's fog code is identical to Tribes 2's. I think Nic is right on with his comment. Good eye, Nic, I didn't think of that. :)
#9
11/14/2004 (9:47 am)
Yeah, I'll just have to play more with the editor to find out where to change that! I'll report back later...
#10
in my copy of torque, it seems like visible distance is tied to fog distance. and that fog distance only controls the near fog value. where the fogging starts. in the mission editor that is.
besides even if you have your fog distance and visible distance match. if the skybox behind the fogged thing doesn't match the fog color you get the same problem.
like I said picking a nice fog color and a skybox that has that same color in the horrizon in all directions will go a long way towards fixing it visually.
11/14/2004 (10:06 am)
Seth it's in the Sky portion of the mission editor.in my copy of torque, it seems like visible distance is tied to fog distance. and that fog distance only controls the near fog value. where the fogging starts. in the mission editor that is.
besides even if you have your fog distance and visible distance match. if the skybox behind the fogged thing doesn't match the fog color you get the same problem.
like I said picking a nice fog color and a skybox that has that same color in the horrizon in all directions will go a long way towards fixing it visually.
#11
But with that said, I do agree with you. I think the fog looks, for lack of a better word, digusting. When I was working on Legends, we changed the fog function to use linear equation, which yields more evenly distributed fog across the fog distance. This makes it look a little better but not by much.
Comparing what our fog looks like to, Half Life 2's for instance, makes matters even worse. But Half Life 2 also doesn't have to deal with terrain so that wouldn't be a fair comparison.
11/17/2004 (8:53 am)
That screenshot of Tribes 2, thats a fog layer, and it just so happens the peak of that hill is poking through the top of it. You can have up to 3 fog layers and you can set the positions of each and the height.But with that said, I do agree with you. I think the fog looks, for lack of a better word, digusting. When I was working on Legends, we changed the fog function to use linear equation, which yields more evenly distributed fog across the fog distance. This makes it look a little better but not by much.
Comparing what our fog looks like to, Half Life 2's for instance, makes matters even worse. But Half Life 2 also doesn't have to deal with terrain so that wouldn't be a fair comparison.
#12
11/17/2004 (8:56 am)
A bit offtopic here but, Robert - you're saying that Half Life 2 doesn't have to deal with the calculations of terrain.. What are they doing to simulate the landscape then? I've seen screenshots with what looks like terrain.
#13
11/17/2004 (10:02 am)
Static maps I imagine. It's not terrain, but rather just a model.
#14
11/17/2004 (10:09 am)
That sounds extremely expensive.
#15
11/17/2004 (10:26 am)
Well I really know nothing about Half Life, I'm just guessing, but you wouldn't need to draw/process the entire map. Being static doesn't make it expensive. Inefficient algorithms and formats would.
#16
11/19/2004 (9:01 am)
How hard would it be to implement Unreal-style volumetric fog in Torque? I have read some articles on how it was done, and seems to only big issue is it requires a fair amount of raycasting calls per frame.
Associate Kyle Carter
You can always extend Torque to use more complex fogging techniques, but the system in place has the benefits of working properly across all objects, being fast and robust, and being "good enough" to give very convincing results. :) Naturally, it's possible to set fog parameters that will break that, but the feature demo should have a properly working example.