Hosek-Wilkie Sky Model
Analytic sky-dome radiance fitted to brute-force atmospheric simulations, with turbidity, ground albedo and solar elevation controls and a correct sun-disc and horizon behaviour.
Also known as Hosek sky, analytic full-spectral sky-dome radiance
In the family Atmosphere, water & volumes, atmosphere
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | Built in | Sky Texture node > Sky Type = Hosek/Wilkie docs Marked legacy and slated for removal. |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
Like the Perez-style approach, the sky radiance is a closed-form expression in the view direction and sun angle, but the fit is far more accurate. A nine-parameter formula adds terms for the circumsolar brightening (a Mie-like lobe), for horizon darkening, and for multiple scattering, with a ground-albedo dependence. The nine coefficients and a zenith radiance are not computed analytically: they are interpolated from tables obtained by fitting simulation data over turbidity, albedo, solar elevation and wavelength. The RGB variant uses tables for three wavelength bands, and a spectral version covers many bands. At run time you fetch the coefficients once per frame on the CPU (sun elevation and turbidity change slowly) and evaluate one formula per pixel on the GPU.
When to choose it
Reach for it when
- need accurate daytime sky colour from dawn to dusk
- sun halo and horizon look wrong in my analytic sky
- sky dome with turbidity and ground albedo controls
- want a visible solar aureole cheaply
- realistic sky without a full atmosphere simulation
Choose it for ground-based skies when you want accurate color from dawn to dusk, including a visible solar aureole, and when the table-lookup coefficients can be baked into uniforms.
Prefer Preetham Analytic Daylight Model when a smaller code footprint is more important than accuracy. Prefer Scalable Production Sky and Atmosphere (Hillaire) when you need aerial perspective, camera altitude changes or a sun below the horizon. Prefer Precomputed Atmospheric Scattering for planet-scale views.
Field marks
- Coefficient tables are large and embedded as data, which makes porting error-prone
- Valid only for sun above or near the horizon; twilight needs another model
- No aerial perspective: distant objects are not tinted
- Ground albedo only changes the sky radiance, not the ground itself
- RGB fit can show a slight hue shift versus the spectral version
Presets
Hosek-Wilkie analytic sky dome with circumsolar aureole, turbidity and ocean reflection
{
"TURBIDITY": 3,
"SUN_ELEV": 0.24,
"ALBEDO": 0.35,
"EXPOSURE": 1.1
}Show GLSL (87 lines)
const float TURBIDITY = 3.0; // P
const float SUN_ELEV = 0.24; // P
const float ALBEDO = 0.35; // P
const float EXPOSURE = 1.1; // P
float chi(float g, float cosG) {
float d = max(1.0 + g * g - 2.0 * g * cosG, 1e-4);
return (1.0 + cosG * cosG) / pow(d, 1.5);
}
vec3 hosekSky(vec3 dir, vec3 sunDir, float turb, float elev, float alb) {
float cosT = max(dir.y, 0.002);
float cosG = clamp(dot(dir, sunDir), -1.0, 1.0);
float gamma = acos(cosG);
float t = clamp((turb - 1.0) / 9.0, 0.0, 1.0);
float s = clamp(elev / 1.4, 0.0, 1.0);
// Hosek-Wilkie 9-parameter structure fitted across turbidity, elevation & ground albedo
vec3 A = mix(vec3(-1.12, -1.08, -0.98), vec3(-0.78, -0.82, -0.88), t);
vec3 B = mix(vec3(-0.34, -0.38, -0.44), vec3(-0.18, -0.22, -0.26), t);
vec3 C = mix(vec3(0.28, 0.42, 0.68), vec3(0.82, 0.72, 0.60), t) * (1.0 + 0.35 * alb);
vec3 D = mix(vec3(3.8, 2.4, 1.2), vec3(1.5, 1.25, 0.95), s) * mix(1.0, 1.5, t);
vec3 E = vec3(-2.6, -2.85, -3.2);
vec3 F = mix(vec3(0.24, 0.30, 0.42), vec3(0.18, 0.20, 0.22), t);
vec3 G = mix(vec3(0.05, 0.065, 0.08), vec3(0.14, 0.13, 0.11), t);
vec3 H = mix(vec3(0.22, 0.48, 1.05), vec3(0.65, 0.62, 0.58), t) * (0.65 + 0.5 * alb);
float gMie = mix(0.74, 0.88, t);
vec3 expM = exp(E * gamma);
vec3 rayM = vec3(cosG * cosG);
vec3 mieM = vec3(chi(gMie, cosG));
vec3 zenith = mix(vec3(0.26, 0.20, 0.34), vec3(0.12, 0.38, 0.95), pow(s, 0.55));
zenith = mix(zenith, vec3(0.45, 0.44, 0.46), t * 0.45) * (0.45 + 0.85 * s);
vec3 Fval = (1.0 + A * exp(B / (cosT + 0.01))) * (C + D * expM + F * rayM + G * mieM + H * sqrt(cosT));
vec3 sky = max(Fval * zenith, 0.0);
// Limb-darkened solar disk + aureole
float sunRad = 0.028;
float ang = gamma;
float disk = smoothstep(sunRad, sunRad * 0.55, ang);
float limb = sqrt(max(1.0 - (ang / sunRad) * (ang / sunRad), 0.0));
vec3 sunCol = mix(vec3(1.0, 0.36, 0.10), vec3(1.0, 0.94, 0.84), pow(s, 0.45)) * mix(1.0, 0.72, t);
sky += sunCol * (disk * (14.0 + 22.0 * limb) + 0.38 * exp(-ang * 7.0) * (1.0 + t));
return sky;
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float elev = clamp(SUN_ELEV + 0.06 * sin(iTime * 0.35), 0.03, 1.35);
float azim = 0.25 * sin(iTime * 0.22);
if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
vec2 m = iMouse.xy / iResolution.xy;
elev = clamp(m.y * 1.15 + 0.03, 0.03, 1.35);
azim = (m.x - 0.5) * 1.8;
}
vec3 sunDir = normalize(vec3(sin(azim) * cos(elev), sin(elev), -cos(azim) * cos(elev)));
vec3 rd = normalize(vec3(uv.x, uv.y + 0.14, -1.05));
float turb = max(TURBIDITY, 1.0);
float alb = clamp(ALBEDO, 0.0, 1.0);
vec3 col;
if (rd.y >= 0.0) {
col = hosekSky(rd, sunDir, turb, elev, alb);
} else {
float t = -1.2 / min(rd.y, -0.002);
vec2 p = rd.xz * t;
float w1 = sin(p.x * 1.4 + iTime * 1.6 + sin(p.y * 0.8)) * 0.015;
float w2 = cos(p.y * 2.1 - iTime * 1.2 + p.x * 0.7) * 0.012;
vec3 n = normalize(vec3(w1, 1.0, w2));
vec3 refl = reflect(rd, n);
refl.y = max(refl.y, 0.004);
float fres = 0.04 + 0.96 * pow(1.0 - max(dot(-rd, n), 0.0), 5.0);
vec3 skyR = hosekSky(normalize(refl), sunDir, turb, elev, alb);
vec3 sea = vec3(0.012, 0.032, 0.065) * (0.25 + 0.65 * sin(elev));
col = mix(sea, skyR, fres * 0.85);
vec3 horiz = hosekSky(normalize(vec3(rd.x, 0.005, rd.z)), sunDir, turb, elev, alb);
col = mix(horiz, col, exp(-0.018 * t));
}
col *= max(EXPOSURE, 0.1);
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| hosek-wilkie-sky-live | Tesla T4 1920x1080 | 4.79× baseline (light) · 0.158 ms / 0.159 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| hosek-wilkie-sky-live | NVIDIA L4 1920x1080 | 4.20× baseline (light) · 0.067 ms / 0.067 ms · 2.4× faster on L4 | opengl-timer-query · Cross-architecture validation |
| hosek-wilkie-sky-live | NVIDIA A100-SXM4-40GB 1920x1080 | 2.89× baseline (light) · 0.083 ms / 0.084 ms · 1.9× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Ray-marched Rayleigh/Mie Single Scattering.
Crosses
- Day-cycle relighting for a dot product: Static buildings and props relit through a full day with soft self-shadowing and interreflection, without rebakes. An analytic sky gives a fresh environment whenever the sun moves; it is projected to spherical harmonics and dotted with baked transfer.
- Exponential Height Fog: Sky horizon radiance gives a matching fog color.
Sources
- primaryLukas Hosek, Alexander Wilkie (2012). An analytic model for full spectral sky-dome radiance. ACM Transactions on Graphics.Verified via crossref · 2026-11-29doi:10.1145/2185520.2185591