Skip to main content

sky_hosek_compute_irradiance_by_direction

Classes

FindHosekCoeffs
EvalHosekCoeffs

Members

mRadXYZ[0] : Float32Array

Overall average radiance Vec3f

Functions

EvalQuintic_2(w, data, data_offset)number
EvalQuintic_3(w, data, data_offset, coeffs, coeffs_offset)
FindQuinticWeights(s, w)
ZenithLuminance(thetaS, T)number
sky_hosek_precompute(mCoeffsXYZ, mRadXYZ, sun_direction, turbidity, rgbAlbedo, overcast)
sky_hosek_compute_irradiance_by_direction(out, mCoeffsXYZ, mRadXYZ, mToSun, direction_x, direction_y, direction_z)

FindHosekCoeffs

Kind: global class

new FindHosekCoeffs(dataset9, datasetR, turbidity, albedo, solarElevation, coeffs, coeffs_offset)

ParamTypeDescription
dataset9Array.<number> | Float32Arrayalbedo x 2, turbidity x 10, quintics x 6, weights x 9
datasetRArray.<number> | Float32Arrayalbedo x 2, turbidity x 10, quintics x 6
turbiditynumber
albedonumber
solarElevationnumber
coeffsArray.<number> | Float32Arrayresult is written here
coeffs_offsetnumber

EvalHosekCoeffs

Kind: global class

new EvalHosekCoeffs(coeffs, coeffs_offset, cosTheta, gamma, cosGamma)

Hosek: (1 + A e ^ (B / cos(t))) (1 + C e ^ (D g) + E cos(g) ^ 2 + F mieM(g, G) + H cos(t)^1/2 + (I - 1))

These bits are the same as Preetham, but do different jobs in some cases A: sky gradient, carries white -> blue gradient B: sky tightness C: sun, carries most of sun-centred blue term D: sun tightness, higher = tighter E: rosy hue around sun

Hosek-specific: F: mie term, does most of the heavy lifting for sunset glow G: mie tuning H: zenith gradient I: constant term balanced with H

Notes: A/B still carries some of the "blue" base of sky, but much comes from C/D C/E minimal effect in sunset situations, carry bulk of sun halo in sun-overhead F/G sunset glow, but also takes sun halo from yellowish to white overhead

ParamType
coeffsArray.<number> | Float32Array
coeffs_offsetnumber
cosThetanumber
gammanumber
cosGammanumber

mRadXYZ[0] : Float32Array

Overall average radiance Vec3f

Kind: global variable

EvalQuintic_2(w, data, data_offset) ⇒ number

Kind: global function

ParamTypeDescription
wArray.<number> | Float32Arrayfloat[6]
dataArray.<number> | Float32Arrayfloat[6]
data_offsetnumber

EvalQuintic_3(w, data, data_offset, coeffs, coeffs_offset)

Kind: global function

ParamTypeDescription
wArray.<number> | Float32Arrayfloat[6]
dataArray.<number> | Float32Arrayfloat[6][9] flattened
data_offsetnumber
coeffsArray.<number> | Float32Arrayfloat[9] output is written here
coeffs_offsetnumber

FindQuinticWeights(s, w)

Kind: global function

ParamType
snumber
wArray.<number> | ArrayLike.<number> | Float32Array

ZenithLuminance(thetaS, T) ⇒ number

Kind: global function

ParamType
thetaSnumber
Tnumber

sky_hosek_precompute(mCoeffsXYZ, mRadXYZ, sun_direction, turbidity, rgbAlbedo, overcast)

Kind: global function
See: https://github.com/andrewwillmott/sun-sky/blob/master/SunSky.cpp

ParamTypeDescription
mCoeffsXYZArray.<number>output, float[3][9], Hosek 9-term distribution coefficients
mRadXYZArray.<number>output, vec3, Overall average radiance
sun_directionvec3
turbiditynumbershould be between 1 and 10
rgbAlbedovec3albedo in linear color space (make sure it's not sRGB)
overcastnumber

sky_hosek_compute_irradiance_by_direction(out, mCoeffsXYZ, mRadXYZ, mToSun, direction_x, direction_y, direction_z)

Kind: global function

ParamTypeDescription
outArray.<number> | Float32Arrayvec3 in RGB color space
mCoeffsXYZArray.<number> | Float32Arrayfloat[3][9]
mRadXYZArray.<number> | Float32Arrayvec3
mToSunArray.<number> | Float32Arrayvec3
direction_xnumber
direction_ynumber
direction_znumber