Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate expected color temperature of daylight

I have a location (latitude/longitude) and a timestamp (year/month/day/hour/minute).

Assuming clear skies, is there an algorithm to loosely estimate the color temperature of sunlight at that time and place?

If I know what the weather was at that time, is there a suggested way to modify the color temperature for the amount of cloud cover at that time?

like image 934
Dean J Avatar asked Jul 03 '15 05:07

Dean J


1 Answers

I suggest taking a look at this paper which has nice practical implementation for CG applications:

A Practical Analytic Model for Daylight A. J. Preetham Peter Shirley Brian Smits

Abstract

Sunlight and skylight are rarely rendered correctly in computer graphics. A major reason for this is high computational expense. Another is that precise atmospheric data is rarely available. We present an inexpensive analytic model that approximates full spectrum daylight for various atmospheric conditions. These conditions are parameterized using terms that users can either measure or estimate. We also present an inexpensive analytic model that approximates the effects of atmosphere (aerial perspective). These models are fielded in a number of conditions and intermediate results verified against standard literature from atmospheric science. Our goal is to achieve as much accuracy as possible without sacrificing usability.

Both compressed postscript and pdf files of the paper are available.

Example code is available.

Color images from the paper are shown below.

Link only answers are discouraged but I can not post neither sufficient portion of the article nor any complete C++ code snippet here as both are way too big. Following the link you can find both right now.

like image 74
isp-zax Avatar answered Oct 16 '22 09:10

isp-zax