flat out float atmosphere_planetRadius;
flat out vec2 atmosphere_scaleHeights;
flat out vec2 atmosphere_scaledPlanetRadius;
flat out vec3 colAtmosSunlight;
flat out float atmosphere_atmosphereRadius;
flat out float atmosphere_atmosphereRadiusSquared;
flat out float atmosphere_lowerLimit;
flat out mat2x3 atmosphere_coefficientsScattering;
flat out mat3x3 atmosphere_coefficientsAttenuation;

#define WavelengthR 700
#define WavelengthG 520
#define WavelengthB 430

#define RayleighCoefficient 0


void atmosVars() {
	const float water_IOR = 1.333; //0 deg C
	const float air_IOR = 1.00029;
	const float kilometer = 1000.0;
	float airDensityMod = biomeCold*3+biomeSnow*2.5+biomeTropic*(-0.5)+biomeHot*(-0.7)+(cameraPosition.y/128);
	float scaleMod = biomeHot*1.5;
	float airNumberDensity       = (2.5035422+airDensityMod)*1e25;
	const float ozoneConcentrationPeak = 8e-3 / kilometer;
	float ozoneNumberDensity     = airNumberDensity * exp(-35e3 / 8e3) * ozoneConcentrationPeak;
	const vec3  ozoneCrossSection      = vec3(4.51103766177301E-21, 3.2854797958699E-21, 1.96774621921165E-22); // cm^2 | single-wavelength values.
	atmosphere_planetRadius = 6731 * kilometer;
	float atmosphere_planetRadiusSquared = atmosphere_planetRadius*atmosphere_planetRadius;
	float atmosphere_atmosphereHeight = 110 * (1-biomeCold*0.6) * kilometer;
	atmosphere_scaleHeights     = vec2(8.0+scaleMod, 1.2) * kilometer;
	const vec3 lambda = vec3(WavelengthR, WavelengthG, WavelengthB) * 1e-9;

	#if RayleighCoefficient == 1
    vec3 atmosphere_coefficientRayleigh = vec3(5.8e-3, 1.3e-2, 3.31e-2) / kilometer;
	#elif RayleighCoefficient == 0
    vec3 atmosphere_coefficientRayleigh = (8 * pow3(pi) * pow2(air_IOR * air_IOR - 1)) / (3 * airNumberDensity * pow(lambda, vec3(4.0)));
	#endif
	const vec3 atmosphere_coefficientOzone    = vec3(9.03485852e-7, 6.58026985e-7, 3.94106856e-8); //These are the final numbers for the ozone coefficient. They are obtained via this equation: OzoneCrossSectionValue * ((2.5035422e25 * 8e-6) * 1e-6)
	//So for example: Red = 4.51103766177301E-21 * ((2.5035422e25 * 8e-6) * 1e-6)
	//Green = 3.2854797958699E-21 * ((2.5035422e25 * 8e-6) * 1e-6)
	//Blue = 1.96774621921165E-22 * ((2.5035422e25 * 8e-6) * 1e-6)
	const vec3 atmosphere_coefficientMie      = vec3(15e-3) / kilometer;
	vec2  atmosphere_inverseScaleHeights     = 1.0 / atmosphere_scaleHeights;
	atmosphere_scaledPlanetRadius      = atmosphere_planetRadius * atmosphere_inverseScaleHeights;
	atmosphere_atmosphereRadius        = atmosphere_planetRadius + atmosphere_atmosphereHeight;
	atmosphere_atmosphereRadiusSquared = atmosphere_atmosphereRadius * atmosphere_atmosphereRadius;
	atmosphere_lowerLimit = atmosphere_planetRadius + -10e3;
	float atmosphere_lowerLimitSquared = atmosphere_lowerLimit * atmosphere_lowerLimit;
	atmosphere_coefficientsScattering  = mat2x3(atmosphere_coefficientRayleigh, atmosphere_coefficientMie);
	atmosphere_coefficientsAttenuation = mat3x3(atmosphere_coefficientRayleigh, atmosphere_coefficientMie * 1.11, atmosphere_coefficientOzone); // commonly called the extinction coefficient
	colAtmosSunlight = blackbody(tempSunlight);
}