Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

This is a very short question. I want to implement ambient light in the color of daylight from the sun. What is the color value of sun light?

share|improve this question
    
when you say "ambient" are you referring to a global light value, or will the light from the sun be directed from a source (the sun)? –  Eric B Jan 7 '13 at 17:32
    
It will be applied as global light value multiplied by a number smaller than one. –  danijar Jan 7 '13 at 17:43
2  
Why would game developers know what color daylight is? –  Byte56 Jan 7 '13 at 18:10
    
@Byte56. Maybe there is a live stream?! –  danijar Jan 7 '13 at 22:29

2 Answers 2

up vote 3 down vote accepted

That depends. Our perceived color of the sun depends on a variety of factors -- the color we observe is due primarily to the scattering of the light in the atmosphere, so the content and quality of the atmosphere has an impact along with the sun's relative position in the sky.

Wikipedia's article on color temperature has some reference values for the sun, but does note that they may vary wildly. However if all you're after is a quick-and-dirty color value, one of them may suffice.

Practically speaking, the formula you use to apply this color in your lighting calculations will have a large impact on the resulting scene as well. Simply modulating the color into your lighting calculations as an ambient term might result in overly orange or tinted renders -- in many cases, you'll probably want to either use something more complex to make the impact of the sunlight color subtle, or you'll want to do nothing at all (if your scenes are always in "broad daylight" you don't really need to involve simulation of the sunlight).

Especially if you're going to have the sunlight color vary based on the time of day (or weather conditions) you'll also want to consider rendering your skybox appropriately. Papers such as Preetham/Shirley/Smit's's Practical Analytical Model for Daylight are a good place to look at for reference and inspiration. You can also check out this repository of sky-rendering-related links.

share|improve this answer

At midday, RGB of (1,1,1) or plain white light.

At sunrise, a little more blue looks pretty good. Tweak until you have good results.

At sunset, a lot more red looks good. Tweak as above.

At evening or night, go with a dark blue. This isn't really based in reality but it's common enough.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.