mole_man

Darken ground with altitude

Recommended Posts

Getting some great results fiddling with PTA. Thanks for the tool.

I was trying to think about how to darken the terrain with altitude, reducing the light level of the ground in linear line from say 10,000 ft. Writing that expression is way beyond me.

If it is possible to do, I would appreciate help in getting an expression to work.

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Here an example of how to lower terrain lighting when going higher :

1.0 - ( cb_altitude / 13000 * 0.2 )

On ground level you have a terrain brightness of 1.0

Up to 13000 m it is lowered gradually till it is 0.2 lower ( so 0.8 ).

At 6500 m : 1.0 - ( 6500 / 13000 * 0.2 )  =  1.0 - ( 0.5 * 0.2 ) = 1.0 - ( 0.1 ) = 0.9

 

regards, Gerard

 

Share this post


Link to post
Share on other sites

Had to go a bit deeper to get it to work. Just reducing the diffuse was not getting the full effect, and was also reducing down to black higher up, so I needed to clamp it. I think I have worked out a solution, but the maths is not that elegant, and appreciate input if there is a better way to do it.

The aim is to reduce the brightness of terrain, and buildings up to an altitude of 25,000 ft (more realistic for UK winter flying), then clamp it there. I have come up with;

[LIGHTING_TERRAIN_LIGHTING]
IsActive=1
SunDiffuseCoeff=(clamp(3.0 - (cb_Altitude/3048), 0.4, 2.4))
SunAmbientCoeff=(clamp(0.72 - (cb_Altitude/12700), 0.1, 0.6))
MoonDiffuseCoeff=1.50
MoonAmbientCoeff=1.00

[LIGHTING_AUTOGEN_LIGHTING]
IsActive=1
SunDiffuseCoeff=(clamp(3.0 - (cb_Altitude/3048), 0.5, 2.4))
SunAmbientCoeff=(clamp(0.72 - (cb_Altitude/12700), 0.1, 0.6))
MoonDiffuseCoeff=0.8
MoonAmbientCoeff=0.5

[LIGHTING_TERRAIN_SATURATION]
IsActive=1
SaturateRatio=(clamp(0.9 - (cb_Altitude/38100), 0.7, 0.9))

Before the tweak

beforetweak.jpg

 

After the tweak

aftertweak.jpg

Using this formula, the darkening effect does not start until around 6000 ft

If you want to try the formulas, you will probably need to fiddle with the values to fit your preset, HDR lighting etc.

The last two figures are the clamp figures, so you can use those to constrain the results, especially the lower figure. Set to a higher number and it won't get so dark.

Share this post


Link to post
Share on other sites

Bear in mind that the overall sunlight is already different in all seasons. So in the winter everything is darker than in the summer.  Also the sky.

And by climbing the scenery also gets a little darker.

It might be a good idea to darken AG as It sometimes can be seen at a too high altitude.

Share this post


Link to post
Share on other sites
11 hours ago, mole_man said:

The aim is to reduce the brightness of terrain, and buildings up to an altitude of 25,000 ft (more realistic for UK winter flying), then clamp it there. I have come up with;

[LIGHTING_TERRAIN_LIGHTING]
IsActive=1
SunDiffuseCoeff=(clamp(3.0 - (cb_Altitude/3048), 0.4, 2.4))
SunAmbientCoeff=(clamp(0.72 - (cb_Altitude/12700), 0.1, 0.6))
MoonDiffuseCoeff=1.50
MoonAmbientCoeff=1.00

[LIGHTING_AUTOGEN_LIGHTING]
IsActive=1
SunDiffuseCoeff=(clamp(3.0 - (cb_Altitude/3048), 0.5, 2.4))
SunAmbientCoeff=(clamp(0.72 - (cb_Altitude/12700), 0.1, 0.6))
MoonDiffuseCoeff=0.8
MoonAmbientCoeff=0.5

[LIGHTING_TERRAIN_SATURATION]
IsActive=1
SaturateRatio=(clamp(0.9 - (cb_Altitude/38100), 0.7, 0.9))

To make others understand these expressions :

25000 ft = 7620 m

SunDiffuseCoeff=(clamp(3.0 - (cb_Altitude/3048), 0.4, 2.4))  —> direct sunlight on the terrain

Minimum value = 0.4 

Maximim value = 2.4

Starting value = 3.0

At 0 m altitude : 3.0 - 0 = 3.0 —> max value 2.4       —> 3.0 - ( 0/3048 ) = 3.0 - 0 

At 1000 m altitude : 3.0 -  0.33 = 2.67 —> max value 2.4     —> 3.0 - ( 1000/3048 ) = 3.0 - 0.33

At 1968.5 m altitude : 3.0 - 0.6 = 2.4     —> 3.0 - ( 1968.5/3048 ) = 3.0 - 0.6 

So above 1968.5 m ( 6458.33 ft ) the diffuse lighting starts to get less till the min value of 0.4 , which will be at 7925 m ( 26000.66 ft )

At 5000 m altitude : 3.0 - 1.95 = 1.05     —> 3.0 - ( 5000/3048 ) = 3.0 - 1.95

Any higher than 7925 m ( 26000.66 ) and it will stay at the minimum value of 0.4.

At 10000m altitude , which is above 26000.66 ft : 3.0 - 2.6 = 0.4     —> 3.0 - ( 10000/3048 )  —>   3.0 - ( 3.28 ) = - 0.72 which is less than the minimum of 0.4 , so the value will be 0.4

 

 

 

 

 

Share this post


Link to post
Share on other sites

Good explanation.

What is AG short for? Not sure what to look at tweaking next to fine tune the effect.

Share this post


Link to post
Share on other sites
13 minutes ago, mole_man said:

Good explanation.

What is AG short for? Not sure what to look at tweaking next to fine tune the effect.

AG = autogen 

Autogen Lighting ( window/door lights )

Object lights ( brightness of the buildings and trees  —> as you darken terrain and AG lights , you also should darken the buildings .....

Share this post


Link to post
Share on other sites

Autogen lighting is just for night lights I think, 'Autogen Emissive Lighting'? I like to keep them bright, but users could put same formulas into that section to darken nightlights with altitude.

Not tested in every season/TOD yet. Will end up with many presets through the year I expect, and probably different parts of the world do not see the ground go so dark with altitude as it does in Northern Europe/USA

How to vary the formula by season is the next challenge...

Share this post


Link to post
Share on other sites
On 11/13/2017 at 10:15 PM, GSalden said:

Here an example of how to lower terrain lighting when going higher :

1.0 - ( cb_altitude / 13000 * 0.2 )

On ground level you have a terrain brightness of 1.0

Up to 13000 m it is lowered gradually till it is 0.2 lower ( so 0.8 ).

At 6500 m : 1.0 - ( 6500 / 13000 * 0.2 )  =  1.0 - ( 0.5 * 0.2 ) = 1.0 - ( 0.1 ) = 0.9

 

regards, Gerard

 

Hi Gerard, 

What would be the line if i wanted the brightness to go up with the altitude ? i want to do this for the urban area lightning brightness. 

 

Thank you as usual !  

Share this post


Link to post
Share on other sites

1.0 + ( cb_altitude / 13000 * 0.2 )

1.0 is your starting point

At 13.000 m it is : 1.0 + ( 1 * 0.2 ) = 1.2


  • Upvote 1

Share this post


Link to post
Share on other sites
2 minutes ago, GSalden said:

1.0 + ( cb_altitude / 13000 * 0.2 )

1.0 is your starting point

At 13.000 m it is : 1.0 + ( 1 * 0.2 ) = 1.2

 

Thanks a lot Gerard ! 

Share this post


Link to post
Share on other sites
3 hours ago, GSalden said:

1.0 + ( cb_altitude / 13000 * 0.2 )

1.0 is your starting point

At 13.000 m it is : 1.0 + ( 1 * 0.2 ) = 1.2

 

Some wrong parameter message when trying to put it there. Got it was missing -()

Share this post


Link to post
Share on other sites
3 hours ago, GSalden said:

1.0 + ( cb_altitude / 13000 * 0.2 )

1.0 is your starting point

At 13.000 m it is : 1.0 + ( 1 * 0.2 ) = 1.2

 

it lets me save it but no ground at all...  

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now