7

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?

Dean J
  • 39,360
  • 16
  • 67
  • 93
  • Probably worth mentioning that in the world of photography, **color temperature** is only [one axis](https://photo.stackexchange.com/a/108962/43103) (blue/yellow axis) of the white balance, the other being the **tint** (green/magenta axis). – Skippy le Grand Gourou Jun 18 '19 at 07:15
  • 1
    Very related: https://physics.stackexchange.com/questions/66448/how-do-you-estimate-colour-temperature-based-on-the-position-of-the-sun-in-the-s – FarO Mar 19 '20 at 13:15

1 Answers1

3

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.

isp-zax
  • 3,833
  • 13
  • 21
  • 1
    here's a updated link to the paper: https://www2.cs.duke.edu/courses/cps124/spring08/assign/07_papers/p91-preetham.pdf – alexbhandari Dec 13 '20 at 22:44