Modeladvanced
Preetham sky model
Also called Preetham-Shirley-Smits sky model.
An analytic model of daylight sky radiance as a function of sun position, view direction and turbidity, fitted to simulated scattering.
The Preetham sky model gives the brightness and color of a clear daylight sky in any view direction with a few exponentials, cheap enough to evaluate per pixel. Its inputs are the position of the sun, the view direction and one number for the haze in the air, the turbidity . Its output is the luminance and the chromaticity of the sky in that direction. Preetham, Shirley and Smits (1999) built it in two steps. First they computed the sky with a numerical simulation of scattering in a model atmosphere, for many sun positions and turbidities. Then they fitted the results with the formula that Perez, Seals and Michalsky (1993) had proposed for measured sky luminance, with five coefficients that depend linearly on . The formula is a fit, so its accuracy is a property of the fit and of the simulation behind it, not a physical law. It is valid only in the range of the fit, , and Zotti, Wilkie and Purgathofer (2007) showed that it gives wrong and even negative values outside that range and that it differs from measured skies inside it. Because it has no tables and needs no precomputation, it suits a sky background and a light source for image-based lighting when the sky must change with the time of day.
The machine
Angles. All angles are in radians.
| symbol | meaning | range |
|---|---|---|
| zenith angle of the sun | ||
| zenith angle of the view direction | ||
| azimuth of the view relative to the sun | ||
| angle between the view direction and the sun |
The angle to the sun follows from the others: .
Turbidity. , where is the optical thickness of the molecules of the air and that of the haze. A sky of pure air has , and more haze gives a larger . The fit covers from 2 to 6, so the valid range of the model is .
The distribution. Each of the three outputs , and has the form of the Perez formula,
scaled so that the value at the zenith is the zenith value:
The first factor is the gradient from the zenith to the horizon. The second factor has a peak around the sun, the term , and a term for light scattered forward and backward. The same formula, with other coefficients, gives and from their zenith values and .
The coefficients. Each coefficient is linear in . For the luminance:
| coefficient | value |
|---|---|
For they are , , , , . For they are , , , , . All are tuning constants of the fit.
The zenith. The zenith luminance, in , is
The zenith chromaticities and are also fitted functions of and , with their constants in the appendix of the paper.
Evaluation.
PREETHAM-SKY(T, θ_s, θ, φ - φ_s)- 1
for each output c in (Y, x, y): (A, B, C, D, E)_c ← linear functions of T ▷ once per frame - 2
Y_z ← the zenith luminance of T and θ_s; (x_z, y_z) ← the zenith chromaticity of T and θ_s - 3
γ ← acos(cos θ cos θ_s + sin θ sin θ_s cos(φ - φ_s)) - 4
for each c: F_c ← (1 + A_c e^{B_c / cos θ}) (1 + C_c e^{D_c γ} + E_c cos² γ) - 5
for each c: c ← c_z · F_c / F_c(0, θ_s) ▷ the denominator once per frame - 6
return (Y, x, y), then X ← x Y / y, Z ← (1 - x - y) Y / y
The simulation behind the fit. The sky data came from a simulation in the style of Nishita and coauthors, for 12 sun positions and turbidities from 2 to 6, at 343 view directions per case, about 600 CPU hours in all. The air followed the US Standard Atmosphere with the haze profile of Elterman. The constants of the appendix include a refractive index of air of 1.0003, a molecular density of , a depolarization factor of 0.035 and a Junge exponent of 4 for the haze particles. The fit used Levenberg-Marquardt, a nonlinear least squares method.
Assumptions.
- A clear sky: no clouds, and the haze is uniform in the horizontal direction.
- Single and double scattering only. The third and higher orders of scattering were left out of the simulation.
- No light reflected from the ground. A bright ground, such as snow, makes the real sky brighter near the horizon.
- The observer is at the ground. The model has no altitude input, so it cannot render the sky seen from a plane or from space.
- The sun is above the horizon. There is no twilight.
What it counts
The model counts luminance in and chromaticity in the CIE space, per view direction. A renderer converts to at line L6, then to a linear RGB space, see color spaces, and finally applies tone mapping for display, because the sky is far brighter than a display.
The cost per direction is constant: one cosine, three pairs of exponentials and a few multiplications, time with no memory beyond the 15 coefficients and 3 zenith values. Lines L1 and L2 and the denominators of line L5 run once per change of the sun or the turbidity. A shader can evaluate the model per pixel for the sky background, or once per texel to fill a cube map for environment mapping and image-based lighting.
The model does not count the sun disk itself, which the paper treats with a separate model of sunlight, or the haze in front of distant objects.
Relation to other models
- The Perez model. Perez, Seals and Michalsky (1993) proposed the formula for the luminance of real skies of all kinds, fitted to measurements. Preetham and coauthors kept the formula and refitted its coefficients to a simulation of clear skies, as functions of turbidity. The CIE 2003 Standard General Sky uses a modified form of the same formula with 15 fixed sets of coefficients, and it gives luminance only, without color.
- Physical simulation. The model replaces a simulation of scattering in participating media by a fit to it. A simulation by volumetric path tracing of a model atmosphere can include all orders of scattering and the ground, at a cost of hours, not microseconds.
- Precomputed atmospheric scattering. Precomputed atmospheric scattering stores the result of the scattering integrals in tables, for any altitude and for the sun below the horizon, and computes several orders of scattering. It needs tables and a precomputation, and it models the atmosphere by physical parameters such as scale heights and scattering coefficients instead of turbidity.
- Hosek and Wilkie (2012). Their model keeps the idea of an analytic fit, but fits an extended Perez formula to a brute force simulation, per wavelength band, with the ground albedo as an extra input. Wilkie is also an author of the 2007 critical review of the Preetham model.
Known results in the model
The following are proved properties of the formulas, in exact arithmetic.
- Zenith value. At , the angle to the sun is , so and . The same holds for and .
- Horizon limit. For , as , so the gradient factor tends to 1. For luminance, when , so in the whole valid range.
- Brightening toward the horizon. The derivative of in is . For luminance, when , so for both and are negative and the gradient factor grows from the zenith to the horizon. The gain is , which is about 6.0 at and about 1.08 at : a clear sky is much darker at the zenith than at the horizon, and a hazy sky is almost even.
- The peak around the sun. For luminance, when , so decreases with the angle to the sun throughout the valid range.
- Positive zenith luminance in the valid range. For , the factor is positive, and lies in , so . Then .
- Negative zenith luminance outside it. With the sun at the horizon, and , which is negative for . With the sun at the zenith, is negative for , because the factor of is negative for and is large.
The following are measurements reported by Zotti, Wilkie and Purgathofer (2007), who compared the model with the CIE 2003 Standard General Sky and with their own luminance measurements of clear mid-European skies.
- The zenith luminance becomes negative near the borders of the input space; they advise against the model for exceptionally clear air (), for a sun lower than about above the horizon, and for .
- For the horizon is far too bright, and even for the horizon is too bright when the sun is low ().
- The model does not reproduce the darker sky opposite a low sun: its values there are about 2 to 5 times too high.
- The peak of brightness toward the sun is less steep than in measurements and in the CIE clear sky models.
- The CIE clear sky (type 12) is closest to the model with about 2.3 to 2.5.
Example. Take and a sun from the zenith. The luminance coefficients are , , , and . Then (about ), and .
| view direction | in | ||
|---|---|---|---|
| zenith | 1.4170 | 10.41 | |
| next to the sun, | 3.5773 | 26.29 | |
| , toward the sun | 2.0581 | 15.12 | |
| , away from the sun | 0.8618 | 6.33 | |
| , toward the sun | 1.6816 | 12.36 | |
| , at right angles to the sun | 1.1917 | 8.76 | |
| , away from the sun | 1.0912 | 8.02 |
The sky is brightest around the sun and darkest about from it. At the same angle to the sun, , the direction near the horizon is brighter than the zenith, because of the gradient factor. The value next to the sun is the bright sky around the sun, not the sun disk.
References
- A. J. Preetham, Peter Shirley and Brian Smits, A practical analytic model for daylight, SIGGRAPH 99, 91-100, the sky luminance and chromaticity distributions in the Perez form with coefficients linear in turbidity, the zenith luminance in Appendix A.2, the definition of turbidity and the constants of the scattering simulation in the appendix
- R. Perez, R. Seals and J. Michalsky, All-weather model for sky luminance distribution, preliminary configuration and validation, Solar Energy 50(3), 1993, 235-245, the five parameter formula for the relative sky luminance (general locator)
- Georg Zotti, Alexander Wilkie and Werner Purgathofer, A Critical Review of the Preetham Skylight Model, WSCG 2007, Section 3 (negative zenith luminance outside the fitted range, Figure 1) and Section 6 (comparison with the CIE 2003 Standard General Sky and with measurements)
- Lukas Hosek and Alexander Wilkie, An analytic model for full spectral sky-dome radiance, ACM Transactions on Graphics 31(4), 2012 (SIGGRAPH 2012), the fit of an extended Perez formula to a brute force simulation, with ground albedo as a parameter (general locator)
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag PNVR3Y Edit this page History Report an error Markdown