0

In the file "SkyAtmosphereComponent.cpp", I've found the rayleigh scattering coefficient:

const FLinearColor RayleightScatteringRaw = FLinearColor(0.005802f, 0.013558f, 0.033100f);

But UE don't tell what the formula it bases on, only the numbers...

So I tried to figure out the formula. There is a link about the math which inside SkyAtmosphere: https://www.alanzucconi.com/2017/10/10/atmospheric-scattering-3/#:~:text=Rayleigh%20Scattering%20Coefficient&text=indicates%20the%20fraction%20of%20the,as%20the%20Rayleigh%20scattering%20coefficient.

and I've written a python code to solve it:

import math
def beta(wavelength):
    w = wavelength / 1000000000
    PI = 3.1415926
    n = 1.00029
    N = 2.504e25
    val = (8 * (PI ** 3) * ((n * n - 1) ** 2))/ (3 * N * (w**4))
    print ('{:.11f}'.format(val))
   
    return val

r = beta(680)
g = beta(550)
b = beta(440)

The result of above code is the same with the article:

0.00000519673
0.00001214270
0.00002964526

Then, when I compare these number to the UE's,I found there is a scale between them:

print(r/0.005802, g/0.013558, b/0.033100)
# output
# 1116.4710036505135 1116.555873783846 1116.5361088177956

so the question is, what is the UE's formula? Where does the 1116 comes from?

0 Answers0