Sign in to follow this  

Sunlight lighting

This topic is 4056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm currently tidying up the lighting code for my 3D game engine and I'm trying to improve the dynamic sunlight lighting effects and particularly the colouring. At the moment it is very simple with lighting at night being a dark blue with mainly ambient lighting and a little diffuse 'moonlight' to give some 'shadow' on the buildings and terrain. This gradually changes during the day so that at noon there is much more intense white diffuse lighting with moderately increased same ambient lighting (still with a hint of blue). Now all of this has been okay so far, but I now need to add more realistic lighting including red sunsets and yellow/red (?) dawns. Instead of sorting this out through a trial and error approach I was wondering if there are any tutorials or hints and tips articles that might save me a bit of time and avoid me reinventing the wheel?

Share this post


Link to post
Share on other sites
I don't know of any tutorials off-hand, but Rayleigh scattering and Mie theory are the beasts which you are looking for.

Share this post


Link to post
Share on other sites
taby is correct

Here's a link to some work vterrain atmosphere
check the academic work section

As for correctly affecting the geometry (not just the skybox) you might think of using a vertex or pixel shader, or using image based lighting (IBL)

-Michael g.

Share this post


Link to post
Share on other sites
'A Practical Analytic Model for Daylight' (linked on the page thr33d posted) is the best model for "doing it analytically".

As for sunlight itself (as opposed to the skylight which is what the paper above is concerned with), the best way to simulate the correct colours is to derive the colour of your light from a blackbody emission spectrum (plenty of reference on the internet). There are a few pages out there that will tell you the apparent colour temperature of the sun at noon and at dawn/dusk as well.

Share this post


Link to post
Share on other sites
Quote:
Original post by playmesumch00ns
'A Practical Analytic Model for Daylight' (linked on the page thr33d posted) is the best model for "doing it analytically".

As for sunlight itself (as opposed to the skylight which is what the paper above is concerned with), the best way to simulate the correct colours is to derive the colour of your light from a blackbody emission spectrum (plenty of reference on the internet). There are a few pages out there that will tell you the apparent colour temperature of the sun at noon and at dawn/dusk as well.


I'd never heard of the "blackbody emission spectrum" stuff, so I looked it up wikipedia had a decent article.
I'm assuming this would be for a single light source (a directional light source, for example)

For realistic results, it seems one would want to combine the info from the bb.e.s. stuff (as a directional light source) with IBL (image based lighting) from the skybox (and perhaps ambient occlusion).

-Michael g.

Share this post


Link to post
Share on other sites

This topic is 4056 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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