Fading Fog + Skymap ?!

Blitz3D Forums/Blitz3D Programming/Fading Fog + Skymap ?!

Danny(Posted 2007) [#1]
I know others have had similar issues, but I haven't been able to find a proper solution..

How can you smoothly fade 'fogged objects' into the background - specifically a skybox - without resorting to expensive image-processing and multi-rendering tricks?

Using a fog color that 'roughly matches' my sky background is simply not acceptible since it looks absolutely horrible (anno 2008)...

Did anyone ever find a way around this? Perhaps some external library that can accomplish this (ashadow?)??

here's a test example of what I mean - with the light area being the effect of the fog:


Thanks in advance,
:Danny


Dreamora(Posted 2007) [#2]
The entity autofade capability perhaps, when set to a range similar to the fog one or a little shorter.

Otherwise it will not fade into the background if the Fog does not match the skybox, as it will fade into the fog and pop away


jfk EO-11110(Posted 2007) [#3]
The only solution that I know of and that works nicely, is a SkyPlane:



This is a blue sky and a dark-turkis kind of fog.

The skyplane is a very large quad, and it requires some hills on the horizon because it does not bend to the ground, as a skydome or skybox. Other than that, the fog fades nicely. The texture may be tiled.


Danny(Posted 2007) [#4]
Problem with EntityAutofade is that you can look straight through objects whilst they're in semi-transparent state..

That looks good JFK!
So you've basically got the fog shading / color incorporated into the skymap texture itself to smooth the transition, is that correct? Or have you got a plane stuck in the middle of your geometry at a given distance from the camera?

How then do you deal with distant objects 'popping' into view? - which is what I'm trying to prevent al together...
Also, i've got mountains and such in my scene, meaning low & high altitude objects possibly obscuring the skymap - as opposed to a near flat-horizon as you illustrate...!?!

D.


jfk EO-11110(Posted 2007) [#5]
The fog is not incorporated in the skymap texture itself. But the Skyplane is scaled up in X and Z, so it covers the entire map and fog/view range. Where the sky is closer to the player (right above him) there is less fog, at the horizon there's a max of fog since the distance is higher. It will not pop in since the whole quad is bigger than the fog range. Like other skyboxes, it is parented to the player, and the rotation is reset each frame, as usual. There is a small problem with the fact that dx7 fog is not calculated by the true distance to the camera, but by a rectangular "manhatten" distance, resulting in artefacts when the player is turning around.

Your mountains should however not be higher than the distance to the fog start.

Well, you best try it, it's done quickly.


Leon Drake(Posted 2007) [#6]
i usually go for a singular color on skyzone cubes near the horizon point and set the fog color to match.


Danny(Posted 2007) [#7]
Ah! I see what you mean JFK, that's pretty sneaky!
Nice one... Yes I'm definitely going to play with that idea, cheers!

But yeah, i need to limit the height of the these mountains for sure, because they can seriously ruin all this - especially in the distance..

Thank,
Danny