 		poisson_factor);
 }
 
+#endif
+
+// When USE_REFLECTION_VECTOR is defined, the reflect() function is used for specular
+// light calculation instead of calculating the halfway vector.
+#ifndef MICROFACET
+#define USE_REFLECTION_VECTOR
 #endif
 
 void main() {

	c += light_is_sun * light_color_in * diffuse_base_color *
		adjusted_atmospheric_illumination;
#endif
	LOWP float NdotL = dot(normal, L);
#ifdef EARTH_SHADER
	// If the sun is below the horizon, avoid diffuse and specular reflection.

        // directional).
	L = normalize(light_position_in.xyz - light_position_in.w * position_world_var);
#endif
#ifdef USE_REFLECTION_VECTOR
        MEDIUMP vec3 R;
#else	
	// Calculate the halfway vector.
	MEDIUMP vec3 H = normalize(V + L);
#endif

	MEDIUMP vec3 normal;
	// Save normalized light direction in case it is needed later, before light vectors
