1
0
Fork 0
fgdata/Shaders/HDR/atmos_spectral.glsl

22 lines
646 B
GLSL

#version 330 core
// Extraterrestial Solar Irradiance Spectra, units W * m^-2 * nm^-1
// https://www.nrel.gov/grid/solar-resource/spectra.html
const vec4 sun_spectral_irradiance = vec4(1.679, 1.828, 1.986, 1.307);
const mat4x3 M = mat4x3(
137.672389239975, -8.632904716299537, -1.7181567391931372,
32.549094028629234, 91.29801417199785, -12.005406444382531,
-38.91428392614275, 34.31665471469816, 29.89044807197628,
8.572844237945445, -11.103384660054624, 117.47585277566478
);
vec4 get_sun_spectral_irradiance()
{
return sun_spectral_irradiance;
}
vec3 linear_srgb_from_spectral_samples(vec4 L)
{
return M * L;
}