# Haze value formula help.

## Recommended Posts

Hi guys,

Who is talented enough to help untalented guy like me ?

Heres the thing : i have a value set in the haze tweak and its perfect for day time plus i unticked the density depends on altitude so it create me nice haze at high altitude.

The only thing i want is that during night time the haze effect will be off or at the minimum density as possible.

Who can help me prepare some formula that will do it ?

Thank you !!

##### Share on other sites

I cant get this

Example 1. I don't like it when very thick fog covers the sunset & sky. The first solution is to put a number in the "Sky fog tuning" tweak parameter (0.1, for example). In this case the fog will be reduced, not just during sunrise/sunset, for for the whole day. The second solution is take into account sunlight power as a tweak parameter.

For example, I want the fog influence to stay at it's default value (1.00) at noon and smoothly decrease down to 0.1 at dusk (when sunlight power becomes less than 0.3 as an example). I can use the green component of sunlight as a sunlight power and try linear interpolation expression like this:

Fog influence = 0.1+(SunPower-0)/(0.3-0)*(1-0.1) or

Fog influence = saturate(0.1 + cb_mSun.mDiffuse.g/0.33)

Here cb_mSun.mDiffuse.g is sun power (in the afternoon it's strong and equals ~0.9, at night = 0), saturate function that clamps value in to [0..1]. Don't forget to put whole expression in a parenthesis in Fog influence parameter editor:

(saturate(0.1 + cb_mLights[SUN_LIGHT].mDiffuse.g/0.33)) will be a final expression for "Sky fog tuning" tweak parameter.

i guess thats what i am trying to achieve more or less but cant see it coming together...

##### Share on other sites

Instead of the fixed value you write :

saturate﻿(0.1 + cb_mSun.mDiffuse.g/0.33﻿)

in the text window.

Now you have 1.0 during the day and when the power of the sun becomes lower than 33% of its daytime power the Fog becomes slowly less till 0.1.

If 0.1 is too low you can increase it to your liking.

No need the restart P3Dv4.5.

##### Share on other sites
Posted (edited)
10 hours ago, GSalden said:

Instead of the fixed value you write :

saturate﻿(0.1 + cb_mSun.mDiffuse.g/0.33﻿)

in the text window.

Now you have 1.0 during the day and when the power of the sun becomes lower than 33% of its daytime power the Fog becomes slowly less till 0.1.

If 0.1 is too low you can increase it to your liking.

No need the restart P3Dv4.5.

Thank you very much ! As usual youre the pro 🙂

Just one thing, i need this for the haze effect density value which in my case is 0.00000110 and i would like this to be like 0.0000001 at night. So can your example still be vaild at this scenario?

Thanks again

Edited by roi1862

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×

• Tom Allensworth,
Founder of AVSIM Online

• ### Hot Spots

• Flight Simulation's Premier Resource!

AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!