 
 	{
 
-	    float fog_z = smoothstep(fog_depth_begin, fog_max_distance, length(vertex));
-
-	    fog_amount = pow(fog_z, fog_depth_curve);
-
-	    if (fog_transmit_enabled) {
-		vec3 total_light = gl_FragColor.rgb;
-		float transmit = pow(fog_z, fog_transmit_curve);
-		fog_color = mix(max(total_light, fog_color), fog_color, transmit);
-	    }
+		float fog_z = smoothstep(fog_depth_begin, fog_max_distance, length(vertex));
+
+		fog_amount = pow(fog_z, fog_depth_curve);
+
+		if (fog_transmit_enabled) {
+			vec3 total_light = gl_FragColor.rgb;
+			float transmit = pow(fog_z, fog_transmit_curve);
+			fog_color = mix(max(total_light, fog_color), fog_color, transmit);
+		}
 	}
 #endif
 
 #ifdef FOG_HEIGHT_ENABLED
 	{
-	    float y = (camera_matrix * vec4(vertex, 1.0)).y;
-	    fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve));
-	}
-#endif
-
-	gl_FragColor.rgb = mix(gl_FragColor.rgb,fog_color,fog_amount);
+		float y = (camera_matrix * vec4(vertex, 1.0)).y;
+		fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve));
+	}
+#endif
+
+	gl_FragColor.rgb = mix(gl_FragColor.rgb, fog_color, fog_amount);
 
 #endif //use vertex lit
 


	{

	    float fog_z = smoothstep(fog_depth_begin, fog_max_distance, length(vertex));

	    fog_amount = pow(fog_z, fog_depth_curve);
	}
#endif

#ifdef FOG_HEIGHT_ENABLED
	{
	    float y = (camera_matrix * vec4(vertex_interp, 1.0)).y;
	    fog_amount = max(fog_amount, pow(smoothstep(fog_height_min, fog_height_max, y), fog_height_curve));
	}
#endif
	fog_interp = vec4(fog_color,fog_amount);

#endif //fog


uniform mediump float fog_height_curve;
#endif

#endif //fog

void main() {
