Whole Earth View
Thanks Alexell. This is an interesting endeavor. I'm presently considering an improved formulation for the reflection of diffuse skylight in the ocean that could help things to look more accurate near the limb. The sun glint happens just over the water and is largely a function of the zenith angle of the sun and observer as well as relative azimuth, calculated for each point on the Earth's surface. There is atmospheric attenuation that factors in as well from this geometry.
Beyond this we can set up various aspects of the Earth rendering in Celestia. FarGetaNik made a good start with some parameter adjustments and use of my calibrated Earth texture. Things like the sun glint relationships mentioned above are a set of equations I've coded in FORTRAN. Thus I'd either want to learn more about the code setup used in Celestia or work with someone who can help translate some of the steps. There are various components of the light scattering I've worked on for some time and we could endeavor to transfer each item, such as scattering off of the clouds, aerosols, gases, and land surface. Ozone also absorbs some of the light. Land surface has so-called anisotropic reflectance functions (ARFs) that also apply to thicker clouds. Thin clouds scatter according to a simpler phase function and thicker clouds reflect according to the more detailed geometry. I use a 3-D specification of various cloud/precipitation hydrometeor types.
As a general note I calculate radiances in each of three wavelengths and then convolve with the solar spectrum, CIE color matching functions, and sRGB transfer matrices to come up with the displayed RGB values. I can recall the overall description here: http://stevealbers.net/albers/allsky/tpsblog.html
Beyond this we can set up various aspects of the Earth rendering in Celestia. FarGetaNik made a good start with some parameter adjustments and use of my calibrated Earth texture. Things like the sun glint relationships mentioned above are a set of equations I've coded in FORTRAN. Thus I'd either want to learn more about the code setup used in Celestia or work with someone who can help translate some of the steps. There are various components of the light scattering I've worked on for some time and we could endeavor to transfer each item, such as scattering off of the clouds, aerosols, gases, and land surface. Ozone also absorbs some of the light. Land surface has so-called anisotropic reflectance functions (ARFs) that also apply to thicker clouds. Thin clouds scatter according to a simpler phase function and thicker clouds reflect according to the more detailed geometry. I use a 3-D specification of various cloud/precipitation hydrometeor types.
As a general note I calculate radiances in each of three wavelengths and then convolve with the solar spectrum, CIE color matching functions, and sRGB transfer matrices to come up with the displayed RGB values. I can recall the overall description here: http://stevealbers.net/albers/allsky/tpsblog.html
http://stevealbers.net
- Alexell
- Site Admin
- Posts: 303
- Joined: 07.10.2010
- Age: 30
- With us: 14 years 1 month
- Location: Moscow, Russia
- Contact:
scalbers, The program code is large, it takes time to study it. Maybe someone on the forum who has been here for many years, know which files in Celestia code need to change, to improve rendering and realize your ideas.
Admin of celestia.space
PC: Intel Core i7-8700 @ 3.20GHz, SSD, 16 Gb RAM, NVIDIA GeForce GTX 1080, Creative Sound Blaster ZxR. Windows 10 x64.
Phone: iPhone Xs 256 Gb. iOS 14.
PC: Intel Core i7-8700 @ 3.20GHz, SSD, 16 Gb RAM, NVIDIA GeForce GTX 1080, Creative Sound Blaster ZxR. Windows 10 x64.
Phone: iPhone Xs 256 Gb. iOS 14.
I took the first step of downloading the Celestia code so I can gradually learn about it. I can note there are converters from FORTRAN to C++ so that could help somewhat.
Here's a recent revision of the crescent Earth and sun glint, alongside the Rosetta image from Gordan Ugarkovic. The general idea can be compared even though the cloud and continent locations are different. The actual Rosetta one on the right has more clouds. I think the core of the sun-glint looks a bit better now with the bright yellow/orange color. I'm using less aerosols here, so the continents should be somewhat more visible.
After a few more revisions I updated the Earth phases animation here: http://stevealbers.net/outerspace/animated_phases.gif
Here's a recent revision of the crescent Earth and sun glint, alongside the Rosetta image from Gordan Ugarkovic. The general idea can be compared even though the cloud and continent locations are different. The actual Rosetta one on the right has more clouds. I think the core of the sun-glint looks a bit better now with the bright yellow/orange color. I'm using less aerosols here, so the continents should be somewhat more visible.
After a few more revisions I updated the Earth phases animation here: http://stevealbers.net/outerspace/animated_phases.gif
http://stevealbers.net
I just ran Celestia a bit to see how it handles the Earth and this helps me consider what to look for in the code. For example I can confirm that the sun glint is brighter at noon and dimmer near sunset when actually the opposite is true, unless we are very near sunset. There is dependence of the brightness that is the inverse 4th power of the cosine of the zenith angle of the sun and observer as seen from the ground. That's on top of the Fresnel reflectance coefficient getting stronger. Atmospheric extinction does counter these trends somewhat. We can see where SpecularPower is handled in the code - thus the pieces of this fit together somehow:
https://github.com/CelestiaProject/Celestia/search?utf8=✓&q=specularpower&type=Code
Also a sunset viewed from space is OK, though after sunset the atmosphere is a red rim when in reality it is mostly a blue layer (due somewhat to ozone) with only a very thin red layer embedded.
https://github.com/CelestiaProject/Celestia/search?utf8=✓&q=specularpower&type=Code
Also a sunset viewed from space is OK, though after sunset the atmosphere is a red rim when in reality it is mostly a blue layer (due somewhat to ozone) with only a very thin red layer embedded.
http://stevealbers.net
Sounds good. I think FarGetanik tried earlier to change the Specular power value and it didn't seem to help that much. Perhaps I can figure out more in the code how it works to change the logic (rather than simply the value). I'm wondering if this is a generic thing done in the shaders and/or if the C++ has a detailed handling of this for the Earth? Looks for example like some of the shader handling is here:
https://github.com/CelestiaProject/Celestia/blob/ ... 51122/src/celengine/render.cpp
We can also see if there are relevant parameters that would handle the sunset from space behavior, or if changes in the code logic would be needed. Hopefully I can learn how the compile the code as we go along. I'm running this on a Mac.
https://github.com/CelestiaProject/Celestia/blob/ ... 51122/src/celengine/render.cpp
We can also see if there are relevant parameters that would handle the sunset from space behavior, or if changes in the code logic would be needed. Hopefully I can learn how the compile the code as we go along. I'm running this on a Mac.
http://stevealbers.net
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
I've found some files related to speculatiry in Celestia/shaders. I don't know how to modify them for the desired effects. Is the angle dependency of specular reflection we discussed universal, or specific just for Earth's oceans? I'm thinking of a planet with a smooth icy surface for example.
Added after 42 minutes 25 seconds:
Meanwhile, some improvements on atmosphere parameters again. It's a lot of experimenting. I increased Rayleigh scattering and reduced Mie scattering. Mie seems to make Earth grey, absorbing all colors at dawn. I do have a realistic looking sunset now, just a very dark one... I'm still experimenting with the parameters. I also found a solution using less absorption, resulting in a brighter sunset, but no blue twilight.
Regarding a hazy view of Earth, I feel like Celestia's atmosphere render is not gamma-corrected. The rim seems way to bright relative to the center of the planet. Also a major annoyance with these settings is that the atmosphere cut off at ~20km altitude. The Rayleigh-blue halo of the upper atmosphere gets lost.
Whole Earth view, and a sunset on the surface. Note that the sun still is above the horizon. I increased the brightness on the right half of that view to better show the colors.
Added after 42 minutes 25 seconds:
Meanwhile, some improvements on atmosphere parameters again. It's a lot of experimenting. I increased Rayleigh scattering and reduced Mie scattering. Mie seems to make Earth grey, absorbing all colors at dawn. I do have a realistic looking sunset now, just a very dark one... I'm still experimenting with the parameters. I also found a solution using less absorption, resulting in a brighter sunset, but no blue twilight.
Regarding a hazy view of Earth, I feel like Celestia's atmosphere render is not gamma-corrected. The rim seems way to bright relative to the center of the planet. Also a major annoyance with these settings is that the atmosphere cut off at ~20km altitude. The Rayleigh-blue halo of the upper atmosphere gets lost.
Code: Select all
Atmosphere
{
Height 100
CloudHeight 8
CloudSpeed 65
CloudMap "earth-clouds.*"
CloudShadowDepth 0.9
Mie 0.004
MieAsymmetry 0.1
MieScaleHeight 8.5
Rayleigh [ 0.0052 0.0097 0.0200 ]
Absorption [ 0.0074 0.0058 0.0002 ]
}
Whole Earth view, and a sunset on the surface. Note that the sun still is above the horizon. I increased the brightness on the right half of that view to better show the colors.
The glint looks pretty reasonable for the example above. I think my example animation might be just a slight amount dimmer. I wonder if the bright rim is related to the Mie asymmetry factor being too small? It should be maybe 0.6 to 0.8 somewhere. Mie scale height is around 2-3 kilometers.
I can quickly note that the Fresnel reflection for ice is similar to water, if the ice is smooth. If the ice is perfectly smooth then there wouldn't actually be any glint, just a pure reflection. Any roughness of ice on the surface can sort of emulate waves, and scattering from inside the ice can play a role as well, kind of like whitecaps and sediment do in the ocean.
There are BRDF functions for snow that I use as well, say for the ice sheets of Earth. Thus would Enceladus be more like snow or ice? Does this change for various icy satellites?
I can quickly note that the Fresnel reflection for ice is similar to water, if the ice is smooth. If the ice is perfectly smooth then there wouldn't actually be any glint, just a pure reflection. Any roughness of ice on the surface can sort of emulate waves, and scattering from inside the ice can play a role as well, kind of like whitecaps and sediment do in the ocean.
There are BRDF functions for snow that I use as well, say for the ice sheets of Earth. Thus would Enceladus be more like snow or ice? Does this change for various icy satellites?
http://stevealbers.net
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
Ignore the glint for now, Celestia isn't able to model specularity correctly anyways. I made it a bit brighter than necessary for low phase angles, otherwise it would not appear at all at high phases.
Higher assymetry values make the atmosphere look weird. At +0.7 Earth becomes a white blob at 0° phase... I wonder why by default Earth has a negative Mie assymetry value in Celestia. Well I can't adjust MieScaleHeight independently from RayleighScaleHeight as we discussed. I feel Rayleigh is more important for now... that's a topic for Celestia developement.
Many icy satellites probably display some kind of diffuse specularity. Enceladus is covered in snow. I don't think there is
any smooth ice... I actually meant diffuse reflection on snow-like material in my last post, I'm sorry. I am also thinking of plastic- or metal-like surfaces, often used on 3D models. how would they reflect? Is there any natural material displaying similar properties? Most rough planetary surfaces display an opposite effect, the rim being similary bright compared to the center despite less light hitting the surface due to curvature. This is modeled by Celestia's LunarLambert parameter (incompatible with specularity...)
Higher assymetry values make the atmosphere look weird. At +0.7 Earth becomes a white blob at 0° phase... I wonder why by default Earth has a negative Mie assymetry value in Celestia. Well I can't adjust MieScaleHeight independently from RayleighScaleHeight as we discussed. I feel Rayleigh is more important for now... that's a topic for Celestia developement.
Many icy satellites probably display some kind of diffuse specularity. Enceladus is covered in snow. I don't think there is
any smooth ice... I actually meant diffuse reflection on snow-like material in my last post, I'm sorry. I am also thinking of plastic- or metal-like surfaces, often used on 3D models. how would they reflect? Is there any natural material displaying similar properties? Most rough planetary surfaces display an opposite effect, the rim being similary bright compared to the center despite less light hitting the surface due to curvature. This is modeled by Celestia's LunarLambert parameter (incompatible with specularity...)
On the off chance there is a sign error in the asymmetry factor, then a value of -0.8 might be worth a try?
If we're using simple Henyey-Greenstein functions for Mie scattering - the actual aerosol phase function is a combination of a dominant component with a large positive asymmetry factor and a smaller contribution of a negative value. The latter is for a backscatter peak. I usually use something like a three component phase function (forward scattering for both large and smaller aerosols). I can try to check in the present Celestia code why a negative value would work better.
I think that a snow BRDF may not be that far away from that of thick clouds, say like Venus. Sometime I'll consider making plots of what I'm using for each of these. Plastic/Metal/Ice should have more of a specular component.
If we're using simple Henyey-Greenstein functions for Mie scattering - the actual aerosol phase function is a combination of a dominant component with a large positive asymmetry factor and a smaller contribution of a negative value. The latter is for a backscatter peak. I usually use something like a three component phase function (forward scattering for both large and smaller aerosols). I can try to check in the present Celestia code why a negative value would work better.
I think that a snow BRDF may not be that far away from that of thick clouds, say like Venus. Sometime I'll consider making plots of what I'm using for each of these. Plastic/Metal/Ice should have more of a specular component.
http://stevealbers.net
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
In Celestia, a positive Mie assymetry results in more backscattered light, a negative in more forward scattered light. I get the best results with an assymetry parameter close to 0, at least with my current Mie density. More extreme values result in crazy renders... that can't be real.
I tried a value of 0.7, at least it looks promising:
The haze density is down again, so I have a very dark, contrasty Earth.
At phase angles > 120°, the haze blocks the view from the ground again, at >140° Earth's cresent becomes orange. And any light that is still visible is oversaturated.
But look at this dawn! It is insanely bright, also the bloom effect looks quite nice!
The Mie model you use seems quite complicated... hopefully we can approximate it somehow with a reasonable amount of parameters in Celestia. But there is still just so much wrong. It seems above the horizon, only the component on the far side gets rendered, resulting in a crazy amount of extinction due to absorption and Rayleigh scattering. The component closer to the observer should negate this effect.
I tried a value of 0.7, at least it looks promising:
The haze density is down again, so I have a very dark, contrasty Earth.
At phase angles > 120°, the haze blocks the view from the ground again, at >140° Earth's cresent becomes orange. And any light that is still visible is oversaturated.
But look at this dawn! It is insanely bright, also the bloom effect looks quite nice!
The Mie model you use seems quite complicated... hopefully we can approximate it somehow with a reasonable amount of parameters in Celestia. But there is still just so much wrong. It seems above the horizon, only the component on the far side gets rendered, resulting in a crazy amount of extinction due to absorption and Rayleigh scattering. The component closer to the observer should negate this effect.
Yes, your twilight looks pretty nice. Hopefully I can eventually understand better the Mie handling in the Celestia code, though your description sounds like there is a sign difference. I can suggest that reducing the absorption might be a reasonable thing. In reality this varies with continental aerosols being more absorbing, while marine sources such as sea salt are almost non-absorbing with an SSA of 99% (and more colorless). Does reducing the overall (Mie) aerosols also help any?
Here is a recent twilight compared with a camera image here in Colorado. I'm looking at some issues with the clouds (using real-time data) being too dark. The sky is bluer due to ozone.
Here is a recent twilight compared with a camera image here in Colorado. I'm looking at some issues with the clouds (using real-time data) being too dark. The sky is bluer due to ozone.
http://stevealbers.net
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
Hm I was fixated on remaining a hazy Earth, it seems reducing the Mie fraction doesn't really affect that much, but it lightens up the dawn. Also it seems when using more forward scattering (-0.7) the haze also doesn't change much. Absorption also does not much damage... Is the hazy look of Earth from space more due to Rayleigh or Mie scattering?
Your imagas are pre-sunset, right? Even with high assymetry values, my sky render remains almost black when the sun is below the horizon.
Your imagas are pre-sunset, right? Even with high assymetry values, my sky render remains almost black when the sun is below the horizon.
For the fully lit Earth the hazy appearance is more from Rayleigh scattering and the crescent or high phase angle view is affected more by Mie (when forward scattering is properly introduced). The brownish appearance in the second image of post #52 tells me the Mie absorption may be overdone.
The images I posted were with the sun 7 degrees below the horizon, so is almost mid-twilight.
The images I posted were with the sun 7 degrees below the horizon, so is almost mid-twilight.
http://stevealbers.net
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
Ok thanks for that info. I think I'm at a point where more Rayleigh scattering would have unwanted side effects, maybe it's already too much. But I noticed that it got more realistic with more Rayleigh. I agree on your comment on the amount of Mie scattering - it's hard to get it right with these incorrect models.
I see, I can't recreate these twilight views. (I meant pre-sunrise. The light evidently comes from the east...)
Added after 25 minutes 52 seconds:
The dark dawn seems to be due to my high amount of Rayleigh scattering - but I'm stil far from the brightness in your renders. When applying a gamma value of 2.2 on a screenshot afterwards, I'm getting there.
I see, I can't recreate these twilight views. (I meant pre-sunrise. The light evidently comes from the east...)
Added after 25 minutes 52 seconds:
The dark dawn seems to be due to my high amount of Rayleigh scattering - but I'm stil far from the brightness in your renders. When applying a gamma value of 2.2 on a screenshot afterwards, I'm getting there.
I do have an automatic brightness scaling that depends on how far below the horizon/limb the sun is. Thus it would be the relative brightness in different portions of the sky that would be important. We could adjust the brightness of either of our images somehow to get a closer comparison. Interesting that a gamma correction helps out. I try to have the relative brightness of the twilight and stars to be correct. My images are relatively low resolution so it has to get fairly dark for the stars to come out.
Last edited by scalbers on 24.03.2017, 00:32, edited 1 time in total.
http://stevealbers.net
FarGetaNik wrote:Your imagas are pre-sunset, right? Even with high assymetry values, my sky render remains almost black when the sun is below the horizon.
Maybe I'm a bit off topic, but the
Code: Select all
Atmosphere {
...
Sunset [R G B]
...
}
parameter doesn't do for the case?
Never at rest.
Massimo
Massimo
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
Fenerit, no, unfortunately these parameters are overwritten by Mie and Rayleigh parameters. At least I don't see any effects of them anymore.
Maybe I can match my parameters better by using gamma correctd images. Or I might match Earth with uncorrected space images. At least this confirmed my Rayleigh parameters were to high.
Maybe I can match my parameters better by using gamma correctd images. Or I might match Earth with uncorrected space images. At least this confirmed my Rayleigh parameters were to high.
- FarGetaNik
- Posts: 484
- Joined: 05.06.2012
- With us: 12 years 5 months
- Location: Germany
I just don't see any difference if Sky, Upper, Lower and Sunset parameters are set or not. I can only guess that these are 2 very different ways to render an atmosphere. The color parameters create a diffuse halo around a planet, the Mie and Rayleigh parameters model actual light scattering. The light it scatters is white, but the color paramaters don't affect that. You might it try out yourself changing the color parameters in Earth's default definition in solarsys.ssc, while Mie and Rayleigh are still active.