Feedback Calibrating the air: Help please?

Artlav

Aperiodic traveller
Addon Developer
Beta Tester
Joined
Jan 7, 2008
Messages
5,814
Reaction score
869
Points
203
Location
Earth
Website
orbides.org
Preferred Pronouns
she/her
I'm working on new atmospheric rendering for OGLAClient, attempting to get a nice airshaded aerial view.
The problem is, i have little idea what it looked like, and have no measured pictures.

Maybe someone know where i can get images of mountainous terrain with visible air shading and known camera parameters?
Or, just know the constants for Earth?

What i came up with is below, which ones looks better?
Or, if they all look like total crap, how should it look?

HFO, height fall off, as altitude at which the haze is zero
DNS, fog density, as distance at which the haze is full

Algorithm:
Code:
 float cwp=length(verglobal+vec3(0,rad,0))-rad-alt;
 float fog_distance=length(verscreen)*exp2(-hfo*alt);
 if(abs(cwp)>0.01){
  float t=hfo*cwp;
  fog_distance*=(1.0-exp2(-t))/t;
 }
 float fog_factor=exp2(-abs(fogdensity*fog_distance));
 clamp(fog_factor,0.0,1.0);
 color=(1.0-fog_factor)*fogcolor+color*fog_factor;

Current view Himalayas:
ogla-090320-0.jpg


HFO=10000 DNS=5000:
ogla-090320-1.jpg


HFO=20000 DNS=5000:
ogla-090320-2.jpg


HFO=5000 DNS=5000:
ogla-090320-3.jpg


HFO=10000 DNS=10000:
ogla-090320-4.jpg


HFO=20000 DNS=10000:
ogla-090320-5.jpg


HFO=5000 DNS=10000:
ogla-090320-6.jpg


HFO=10000 DNS=20000:
ogla-090320-7.jpg


HFO=20000 DNS=20000:
ogla-090320-8.jpg


HFO=5000 DNS=20000:
ogla-090320-9.jpg
 
Last edited:
And another location:

Current view grand canyon:
ogla-090320-10.jpg


HFO=10000 DNS=5000:
ogla-090320-11.jpg


HFO=20000 DNS=5000:
ogla-090320-12.jpg


HFO=5000 DNS=5000:
ogla-090320-13.jpg


HFO=10000 DNS=10000:
ogla-090320-14.jpg


HFO=20000 DNS=10000:
ogla-090320-15.jpg


HFO=5000 DNS=10000:
ogla-090320-16.jpg


HFO=10000 DNS=20000:
ogla-090320-17.jpg


HFO=20000 DNS=20000:
ogla-090320-18.jpg


HFO=5000 DNS=20000:
ogla-090320-19.jpg
 
Last edited:
I like HFO=5000 DNS=10000
 
Interestingly, I am currently playing with distance fog as well (see last preview image in http://orbit.medphys.ucl.ac.uk/gallery.html. I am a bit limited by the fact that DX7 doesn't support pixel shaders, and the provided fog algorithms don't really support inhomogeneous atmosphere densities. The only parameters I can play with are the fog colour and the fog density (assuming exponential decay of the original colour component with distance).

The colour mixing is given by
col = original_col * f + fog_col * (1-f)
so looks the same as yours.

The predefined format for f is
f = exp(-rho*dist)
where dist is the camera-pixel distance, and rho is the user-defined fog density.

My solution was to define rho as a two-phase function, with a linear decay from ground level to a reference altitude h_ref, and an inverse altitude decay above the reference altitude (essentially assuming that the bulk of atmospheric scattering occurs below the reference altitude). I haven't got the actual values here, but I think for Earth I assumed a reference altitude of 4km, a ground level density of 5e-5, and a density at reference altitude of 3e-5 (which gave the results shown in the preview picture).

Another component is the fog colour, which needs to be modulated with relative sun position (from a default atmosphere colour at noon, to black after dusk). Again, the lack of pixel shaders means that I need to provide a global value, even if the camera is very high. Still, the results didn't look too bad.
 
The 5000 20000 looks good to me. More so on the green terrain than the brown terrain, but I think that's more because of climatological differences between forest and desert than the rendering. But overall, very realistic!
(I am assuming that the numbers refer to the picture above them)
 
That would make mine 20000 10000. That seems to look like what I remember, flying gliders years ago.
 
The colour mixing is given by
col = original_col * f + fog_col * (1-f)
so looks the same as yours.

The predefined format for f is
f = exp(-rho*dist)
where dist is the camera-pixel distance, and rho is the user-defined fog density.
...
I think for Earth I assumed a reference altitude of 4km, a ground level density of 5e-5, and a density at reference altitude of 3e-5 (which gave the results shown in the preview picture).
Hm.
I tried to use your numbers, but the results came out way different.
I didn't quite understood how do you define density (5e-5 3e-5) values?

What about scattering colors?
How to derive them in your solution relative to the sun and horizon?

Approximately, the reference of 4, density by looks-similar (colors manual):
ogla-090320-20.jpg

ogla-090320-21.jpg
 
Hm.
I tried to use your numbers, but the results came out way different.
I didn't quite understood how do you define density (5e-5 3e-5) values?
They refer to camera altitude. The actual density I used was simply a linear interpolation between the ground level density and the density at reference altitude:
(rho - 5e-5)/(3e-5 - 5e-5) = alt/4km
What about scattering colors?
How to derive them in your solution relative to the sun and horizon?
I simply used the cosine between sun position and camera position, as measured from the centre of Earth, plus some fiddle factors which I can't recall now to to make it fit (e.g. slight brightening after sundown). Currently only equal attenuation of all colour components, no spectral dispersion (e.g. no reddening of haze during dawn/dusk)
 
Wow! That stuff looks nice!

How about making it slightly variable with time to account for changing weather? That way you set some medium numbers allow for offset...
 
I think 20000 10000 looks the best.

One thing to consider though is that the amount of "fog" one would see in reality depends on real weather a lot, especially human factors such as smog around cities (or real fog). That really isn't modeled currently, though. Just a thought that the "correct" value isn't necessarily always the same.

I think for a static view, though, the 20k/10k looks best.

On the weather note, could this be used to make actual clouds? Maybe not the external visual representation of them, but at least the interior? If the camera's inside a cloud, greatly reduce the distance you can see. It would also be interesting if you could do things like different cloud layers, so for example descending into a gas giant you could pass through a region of low visibility, followed by a region of high visibility with a "ceiling" of clouds above and a "floor" of clouds below, etc. That would probably require some kind of cloud texturing though, since just a flat color wouldn't be as good for that sort of thing (everything would blend together).
 
I suppose we can't really produce smog around cities, but is it possible to create natural fog in the valleys (in the local morning) by taking into account the terrain around?

Also, is it possible to change the values relative to the average terrain height or complexity, so that you could at least fill the valleys with fog to make it seem real, while having another value completely where the terrain is flat?
 
I think 20000 10000 looks the best.
That would make mine 20000 10000.
Ok, that one for the temporary baseline.

What about colors?
Should there be a break between the sky and the ground, or a continuous color?
Older ones, that is, or newer one:
ogla-090320-22.jpg

Older:
ogla-090320-5.jpg


One thing to consider though is that the amount of "fog" one would see in reality depends on real weather a lot, especially human factors such as smog around cities (or real fog).
What about a dust/smog/vapor density map, ala height/reflection/nightlights ones?

On the weather note, could this be used to make actual clouds?
.. .
It would also be interesting if you could do things like different cloud layers, so for example descending into a gas giant you could pass through a region of low visibility, followed by a region of high visibility with a "ceiling" of clouds above and a "floor" of clouds below, etc.
Alot of things is possible, but just like in spaceflight, there's only that much instrumentation you can stuff into an interplanetary probe.

The performance is the key problem, having too much effects at once, and it goes down like a stock market, and as the recent OGLA thread shows, low-end PC's already have it unplayable even with all the extra stuff off.

In-cloud fog will run nicely if it's uniform lights-out in all directions, if there are non-uniformites, it goes down quickly. Using fog effect for clouds is either Very Slow, or looks like a bad joke.
Other technics of 3D clouds are not yet explored by me.

How about making it slightly variable with time to account for changing weather? That way you set some medium numbers allow for offset...
That calls for weather simulation of some sort. Just random it, and there will be inconsistencies.

by taking into account the terrain around?
Any call to a terrain function will plung the performance on that scale. Nearly undoable.
 
These fog effects truly add a great realism to Orbiter!

About the fall off altitudes and visibility distance numbers: I think this really should be customizable by user.
They greatly depend on the weather, like thermal inversion conditions.


Here's a photo I took while gliding, an example of an extremely visible inversion:

3371602596_dac555e42a_o.jpg



Note that this thermal inversion layer is at about an altitude of only 1300 ft / 400 m, you don't see this every day. Inversions like this are always a strange experience, you take off with low visibility, and then very abrupt, you can see miles away. Often totally different air too, in this case it flew very calm above (you could release the stick if you wanted), but below it was very turbulent. The gradient between those two conditions was also very abrupt.
Another thing to keep in mind: there's always a huge difference in visibility distance when you look at the sun, or the other way around. However, I'm not sure if this is possible to implement..

Here's an example of the same inversion as above, but viewing the horizon perpendicular to the direction of the sun (sorry for the bad image, had to cut out airbase details):

3371602534_d885aa8ee2_o.jpg



More photos I took during that day here:
http://www.flickr.com/photos/28388745@N04/
Not sure, but maybe you can make use these photos as (color) reference somehow...

regards,
mcduck
 
Back
Top