#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);
			vec3 fogclr = calcFogColor(pos);
			fogclr += fract(dot(gl_FragCoord.xy, vec2(0.25, 0.5))) * 0.00390625; //dither to match sky
			color.rgb = mix(fogclr * min(max(lmcoord.y * 2.0, eyeBrightness.y / 120.0), 1.0), color.rgb, fogAmount);
			#if defined(BLUR_ENABLED) && WATER_BLUR != 0
				waterBlur *= fogAmount;
			#endif

			/*
			float fogAmount = pos.viewDist + wetness * eyeBrightnessSmooth.y * 0.00125 - 0.2; //wetness * 0.3 * eyeBrightness / 240.0
			if (fogAmount > 0.0) {
				fogAmount = fogify(fogAmount * (rainStrength + 1.0) * exp2(1.5 - pos.world.y * 0.015625), FOG_DISTANCE_MULTIPLIER_OVERWORLD);
				vec3 fogclr = calcFogColor(pos);
				fogclr += fract(dot(gl_FragCoord.xy, vec2(0.25, 0.5))) * 0.00390625; //dither to match sky
				color.rgb = mix(fogclr * min(max(lmcoord.y * 2.0, eyeBrightness.y / 120.0), 1.0), color.rgb, fogAmount);
				#if defined(BLUR_ENABLED) && WATER_BLUR != 0
					waterBlur *= fogAmount;
				#endif
			}
			*/
		#endif
#ifdef UNDERWATER_FOG
	}
#endif