Over the years I’ve read a lot about the scattering of light by participating media in the context of rendering, particularly atmospheric scattering as it occurs on Earth. There are a lot of good sources on the subject but very few of them talk about how to quantify sunlight as it exists in space just before entering the atmosphere. If values are given at all they are generally arbitrary constants that produce good enough results. This raises a number of issues:
1) Tuning the parameters to your scattering model can be problematic when you are guessing at how much sunlight to dump into the system. In the face of less than realistic results you can be left asking yourself: Is the sunlight too dim / bright or are the scattering coefficients too small / large? Are the phase functions and scale heights properly calibrated? Why does it look good at sea level but wrong at 5,000 feet? A tedious cycle of tuning parameters can ensue.
2) Point sampling (or otherwise quantizing) the Sun’s spectral power distribution at the RGB primaries, running computations on the approximation and then converting to display dependent values is not necessarily the same as crunching the number on the actual spectral distribution, convoluting with CIE color matching curves and then converting to display dependent values. I’m not sure how much this matters when it comes to the visual quality of the final image but it’s worth investigating and I intend to so.
3) Physically based lighting is all the range these days and outdoor scenes are conveniently lit by a radiance map of incoming skylight generated from an atmospheric scatting simulation. If your sky looks good then your scattering code is probably outputting values with the proper relative intensity but that doesn’t mean they are the right magnitude. This can be a problem when you add artificial light sources to the mix as you can’t tell if your sky is too dim / bright or if your lights are too bright / dim. Another tuning nightmare based mostly on conjecture is likely to ensue. Compounding issues further is your tone mapper which is completely capable of taking absurdly bright or dim values and correcting them.
With this in mind I recently set out to track down a spectral power distribution of the Sun’s irradiance at a distance of one AU as measured by physical instruments. A few papers turned up but they all required subscriptions to scientific journals. The results produced by NASA experiments are public domain and it just so happens that a mission to collect solar irradiance measurements across an impressive range of wavelengths was launched in 2003:
Since April of 2004 the various instruments on the SORCE satellite have been measuring irradiance from the Sun at wavelengths between 0.1 and 2,400 nanometers. The visible spectrum is comfortably inside of that at 360 to 830 nanometers and primarily measured by the SIM instrument; you can get that data in text form here:
Even though the data is labeled “Level 3” (aka processed) it can’t be used directly for rendering. The biggest inconvenience is the irregular sampling interval which makes reconstructing the continuous irradiance distribution awkward. The second hiccup comes in the form of measurement anomalies that must be removed via statistical methods. Initially I assumed “Level 3” meant anomaly free but a visual scan of the text data suggest otherwise. Finally, the satellite does not orbit the Sun at a constant one AU, instead it orbits Earth at a distance of 645 kilometer. This is both good and bad. The Earth’s orbit is elliptical so the amount of incident irradiance changes with the distance to the Sun. While the satellite’s spatial configuration necessitates more work to derive usable numbers it creates an easy way to extract seasonal irradiance values; you can simply window the data processing by date. Earth’s distance to the Sun ranges from 152,098,232 km at apoapsis to 147,098,291 km at periapsis (a difference of 1.76%). That’s a small change and not likely to matter much but it’s still worth considering.
[EDIT: It turns out processing the data prior to publication involves deriving measurements as they would have been collected from a distance of 1 AU based on the orbital ephemerides of the spacecraft as reported by onboard telemetry and corroborated by NORAD. This means windowing the data by date isn’t useful if you want irradiance values as received by Earth on a particular date unless you undo this correction manually. The tool I’ll post later will have an option to do this.]
In a few days I’ll post a command line tool that will process the SIM data into a convenient form based on a given day of the year and a range of wavelengths. Plugging the output into your scattering computations should be straight forward. From there tuning rendering parameters can then be done with the small confidence that your sunlight is properly configured.