Sunlight lighting

Started by
4 comments, last by Jon Alma 17 years, 5 months ago
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?
Jon.
_______________________________________
Legends from the Lost Realms
Advertisement
I don't know of any tutorials off-hand, but Rayleigh scattering and Mie theory are the beasts which you are looking for.
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.
'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.
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.
Thanks for all the info so far - the vterrain articles are turning out to be particularly useful.
Jon.
_______________________________________
Legends from the Lost Realms

This topic is closed to new replies.

Advertisement