Jump to content
Sign in to follow this  
Biology

Potential improvements for sky colors

Recommended Posts

Hi,

I have a huge interest in computer graphics & color science and I have developed Enhanced Cloudscapes and Enhanced Skyscapes for X-Plane. Most modern flight simulators including MSFS, DCS and X-Plane 12 started to use physically based sky implementations and there has been something about them that was really annoying - overly purple sunsets / sunrises. I have been looking into the issue and I finally came up with a solution.

Firstly, the same issue is shared between so many simulators because they all use the same few papers (most notably Eric Bruneton's and Sebastien Hillaire's) as a basis for their implementation, and turns the reference these papers used for some of their parameters had a significant error. The atmosphere is rendered by casting rays and calculating the scattered & absorbed light by physical equations. As different media scatter and absorb light differently, their scattering and absorption behavior is expressed using scattering and absorption coefficients. And the issue lies in how these coefficients are calculated. The physical equations used in atmosphere rendering are normally defined for a spectrum of light, but in computer graphics rendering is not done spectrally but using tristimulus values (such as RGB) due to computing power limitations. This poses an issue as not only the physical equations themselves but the scattering and absorption coefficients as well are defined spectrally (in other words, for a given wavelength) and not for tristimulus values used in rendering. For rendering in RGB, the reference used by these papers picked a single wavelength for red, green and blue as an approximation. The issue is that there isn't a single wavelength for red, green and blue - 680 nm light is red, but so is 630 nm light and this approach of picking a single wavelength for red, green and blue doesn't take that into account. Therefore it is a really poor approximation. My solution was developing a way to take all wavelengths into account when calculating the coefficients for red, green and blue. For this, I used CIE 1931 XYZ color matching functions and converted them into sRGB (as the rendering is done in sRGB color space), which means that now I can convert any wavelength I want into sRGB. My approach is simply using these sRGB values as a weight and taking a weighted average of the coefficients. For instance, when calculating the coefficients for red, if a wavelength has a higher amount of red when converted into sRGB than another wavelength, then it will have a higher contribution to the coefficient as well. Using this approach, I managed to significantly improve the accuracy of the sky colors when tested against a spectral implementation of Sebastien Hillaire's paper and a spectral path tracer.

To validate my approach, I used a root finding algorithm which tried to find the scattering and absorption coefficients which minimized the error between the spectrally rendered reference and also converted a test incoming light and transmitted light into sRGB to solve for the coefficients. In both cases, the expected coefficients almost perfectly matched the coefficients calculated by my approach.

spacer.png

Under the spectrum calculations section, the first line is Rayleigh scattering coefficients and the next line is Ozone absorption coefficients for red, green and blue, calculated using my approach. And the array shown by x are the Rayleigh scattering and Ozone absorption coefficients that match the spectrally rendered reference the best, found by the root finding algorithm. You can see that they are in great agreement.

Finally, I can show you the results.

Using the original coefficients:

spacer.png

Using the coefficients from my approach:

spacer.png

As this approach was recently adopted by X-Plane 12, I decided to use it for comparison as well.

Here's X-Plane 12 with the old coefficients:

spacer.png

And here's X-Plane 12 with the new coefficients:

spacer.png

So, that's all. My work is open source and can be accessed from GitHub: https://github.com/FarukEroglu2048/ARPC

Lastly, why did I create this thread? Because I need your help. Meanwhile my work is open source and really easy to implement (it only requires changing 6 parameters in the game engine), it needs to be implemented by the developers of the simulator. And I really don't know how to contact Asobo developers. In the past the community helped many developers to establish communications with Asobo and I believe that I can have my voice heard by Asobo with the help of you as well. Thank you all in advance.

Edited by Biology
  • Like 73
  • Upvote 6

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post
Share on other sites
Just now, spearmint_flyer said:

Did you post this in their forums? 

I will post there as well, I wanted to start with AVSIM as the community here has been traditionally successful at drawing attention to a wishlist item.

  • Like 5
  • Upvote 1

PC specs: i5-12400F, RTX 3070 Ti and 32 GB of RAM.

Simulators I'm using: X-Plane 12, Microsoft Flight Simulator (2020) and FlightGear.

Share this post


Link to post
Share on other sites

Excellent work. MSFS sky colours have seemed increasingly wide of the mark for me, and, most frustratingly, unchanging by latitude / time of year. 

Don’t know how to practically support you, but if you open a wishlist topic on the official forums, you’ll have my vote!

  • Like 6

i910900k, RTX 3090, 32GB DDR4 RAM, AW3423DW, Ruddy girt big mug of Yorkshire Tea

Share this post


Link to post
Share on other sites

Your work is amazing and will definitely also get my vote if you post this on MSFS's Official Forum! If you happen to do so, please link us to the post here on AVSIM so that we can vote this up. Maybe this will bring some attention to Asobo/MS for implementing this.


ASUS ROG Maximus Hero XII ▪︎ Intel i9-10900K ▪︎ NVIDIA RTX 3090 FE ▪︎ 64GB Corsair Vengeance RGB Pro ▪︎ Windows 10 Pro (21H1) ▪︎ Samsung 970 EVO Pro 1TB NVME SSD (OS Drive) ▪︎ Samsung 860 EVO 2TB SATA SSD ▪︎ Seagate 4TB SATA HDD ▪︎ Corsair RMx 850W PSU

Share this post


Link to post
Share on other sites

Fantastic news.

XP12 is in my opinion, truly the benchmark at the moment when it comes to realistic sky colors. Happy to hear the same mathematics are finding it's way to MSFS, thanks to you.

🙂

  • Like 6

EASA PPL SEPL ( NQ , EFIS, Variable Pitch, SLPC, Retractable undercarriage)
B23 / PA32R / PA28 / DA40 / C172S 

MSFS | X-Plane 12 |

 

Share this post


Link to post
Share on other sites
4 hours ago, Biology said:

the next line is Ozone absorption coefficients

Do you need to have a current atmospheric ozone value to complete the colour calculations?

AFAIK live weather in MSFS doesn’t model ozone dynamically (?)


i910900k, RTX 3090, 32GB DDR4 RAM, AW3423DW, Ruddy girt big mug of Yorkshire Tea

Share this post


Link to post
Share on other sites

You are a genius!  The best visual improvement since 2020. If I were ASOBO I would come pick you up by private plane now without compromise.

 

  • Like 10
  • Upvote 1

CORSAIR 4000 AIRFLOW (WHITE) / RYZEN 5800X3D / ASUS TUF GAMING B550-PLUS / ARTIC LIQUID FREEZERII 240 / 32 GO DDR4 3200 KINGSTON FURY / MSI RTX4090 VENTUS 3X 24G OC / KINGSTON NV1 NVME 2 TO / BE QUIET PURE POWER 11FM  1000W 80PLUS GOLD / SAMSUNG NEO QLED 43" 4K.

Share this post


Link to post
Share on other sites

Superb! @Biology

would be great to bring to MFS what you've done for xp11/!2...

The suggestion to open a thread at Flightsimulator Support Forum is the way to go for a start, but you will probably get faster to their Dev Team by opening a thread here instead:

MSFS DevSupport - SDK Q&A platform for 3rd party developers (flightsimulator.com)

 

  • Like 2

Main Simulation Rig:

Ryzen 5600x, 32GB RAM, Nvidia RTX 3060 Ti, 1 TB & 500 GB M.2 nvme disks, Win11.

Glider pilot since October 1980...

Avid simmer since 1992...

Share this post


Link to post
Share on other sites

Yeah, the X-Plane 12 sky colours are phenomenal. MSFS looks so weird in comparison, so I would love to see this get implemented.

  • Like 2

Asus TUF X670E-PLUS | 7800X3D | G.Skill 32GB DDR @ CL30 6000MHz | RTX 4090 Founders Edition (Undervolted) | WD SNX 850X 2TB + 4TB + 4TB

Share this post


Link to post
Share on other sites

I didn't understand much of the calculations (if any), but I sure know those "Mordor sunsets" in MSFS are a pain and could be easily turned for the better using your input. Please create a Wishlist thread in their official forums asap. Looking forward to better skies! (And I sure hope the "community" hasn't gotten used to those overdramatic, overdone sunsets - but I wouldn't bet on it).

My utmost respect for your knowledge and your much appreciated approach!

Edited by Tom_L
  • Like 4

Gigabyte Aorus Z390Master, i9-9900k @ 5.1 Ghz all cores, RTX 2080, 32 GB RAM

Share this post


Link to post
Share on other sites

This is superb, and very much needed in MSFS.

@Biology  Thanks for giving up your time for free to make flight simulator skies better for all of us!  :smile:

  • Like 5
  • Upvote 1

Call me Bob or Rob, I don't mind, but I prefer Rob.

I like to trick airline passengers into thinking I have my own swimming pool in my back yard by painting a large blue rectangle on my patio.

Intel 14900K in a Z790 motherboard with water cooling, RTX 4080, 32 GB 6000 CL30 DDR5 RAM, W11 and MSFS on Samsung 980 Pro NVME SSD's.  Core Isolation Off, Game Mode Off.

Share this post


Link to post
Share on other sites

Fantastic work! I really hope this gets adopted by MSFS. It looks so much more realistic. I usually skip the sunsets/sunrises in the sim because of how unrealistic they look. 

Edited by Shack95
  • Upvote 1

i9-11900K, RTX 4090, 32 GB ram, Honeycomb Alpha and Bravo, TCA Airbus sidestick and quadrant, Reverb G2

Share this post


Link to post
Share on other sites

My main wish is that the clouds were not over exposed using HDR but I share the authors views on sunsets and the new screenshots are striking.

Another thing is that the water is still far too blue.  When was the Rhine ever that blue or the waters in and around the UK.  It's not like the Caribbean in this part of the world at all.

Perhaps ASOBO could implement water colors that are different for the sea and for rivers.

  • Like 7

Ryzen 5800X3D, Nvidia 3080 - 32 Gig DDR4 RAM, 1TB & 2 TB NVME drives - Windows 11 64 bit MSFS 2020 Premium Deluxe Edition Resolution 2560 x 1440 (32 inch curved monitor)

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
Sign in to follow this  

  • Tom Allensworth,
    Founder of AVSIM Online


  • 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!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...