#ifdef UNDERWATER_FOG
	if (isEyeInWater == 1) {
		color.rgb = calcUnderwaterFogColor(color.rgb, pos, eyeBrightnessSmooth.y / 240.0);
	}
	else {
#endif
		#ifdef FOG_ENABLED_OVERWORLD
			float fogDensity = exp2(
				(
					//equivalen to: (pos.world.y - SEA_LEVEL) * (-1.0 / FOG_HEIGHT_MULTIPLIER_OVERWORLD)
					pos.world.y
					* (-1.0 / FOG_HEIGHT_MULTIPLIER_OVERWORLD)
					+ (SEA_LEVEL / FOG_HEIGHT_MULTIPLIER_OVERWORLD)
				)
				* (1.0 - rainStrength)
				+ (rainStrength * 2.0)
			)
			* FOG_DENSITY_MULTIPLIER_OVERWORLD;
			float fogAmount = fogify(pos.viewDist * fogDensity, 1.0);
			color.rgb = mix(calcFogColor(pos) * min(max(lmcoord.y * 2.0, eyeBrightness.y / 120.0), 1.0), color.rgb, fogAmount);
		#endif
#ifdef UNDERWATER_FOG
	}
#endif