Jump to content
  • entries
  • comments
  • views

Sky lighting & shading

Sign in to follow this  


Today i read again, after many months, about the theory of Rayleigh and Mie scattering, to properly shade my sky.

I did a first implementation following ATI's white paper around a year ago. The results ended up looking pretty good, as you can see on my old engine's page. I had troubles (and so do many people, it seems, from what i saw on some forums) to get a nice daylight blue sky. So i reviewed my old code and compared with the formulas found on white papers on the net.

I am completely amazed.

I didn't implement a single formula correctly.

The exponent exp(x) in the extinction term has been replaced "magically" by a pow(2, x). The units are not correct. The extinction term is modulated by the sun color, while it should actually be in the in-scattering term. Even the angle functions are not correct: a 1 + g^2 - 2.g.cos(thetha) had mysteriously been transformed into a 2.g.cos(thetha) + 1 + g.

I will try to reimplement everything correctly this week.
Sign in to follow this  


Recommended Comments

There are no comments to display.

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

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!