

vec3 torchLight = blackbody(TORCH_TEMP);
	
vec3 sunIrradiance = linearToAP1(SUN_COLOUR * SUN_BRIGHTNESS);

vec3 sunDir = mat3(gbufferModelViewInverse)*normalize(sunPosition);
vec3 moonDir = mat3(gbufferModelViewInverse)*normalize(moonPosition);

float sunCloudsTransmittance = mix(1.0, 0.0, clamp01(wetness*3.));
float moonCloudsTransmittance = mix(1.0, 0.0,clamp01(wetness*3.));

// ATMOSPHERE TRANSMIT
vec3 sunTransmitted = linearToAP1(sunCloudsTransmittance*sunIsVisible*(SUN_COLOUR * SUN_BRIGHTNESS)*clamp01(expf(-getAtmosOpticalDepth(atmosCamPos, sunDir, 8))));//*atmosphereTransmittanceApproximation(atmosCamPos, sunDir));

// sunTransmitted = sunTransmitted * exp(-0.05 * FOG_DENSITY * FOG_ABSORP);
	
vec3 moonIrradiance = linearToAP1(moonCol * moonMult);//vec3(0.8, 0.92, 1.0) * 0.01;


vec3 moonTransmitted = linearToAP1(moonCloudsTransmittance*(moonCol * moonMult)*clamp01(expf(-getAtmosOpticalDepth(atmosCamPos, moonDir, 8))));//*atmosphereTransmittanceApproximation(atmosCamPos, moonDir));

vec3 shadowLightIrradiance = mix(moonIrradiance, sunIrradiance, shadowLightMixer);
vec3 shadowLightTransmitted = mix(moonTransmitted, sunTransmitted, shadowLightMixer);