diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 44ed16e0f95c6afddfc05f1fb779fc637d68529b..f3519dc7cbe83208bdeec7e607332498bbfa349a 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -955,13 +955,13 @@ void LLSettingsSky::updateSettings()
 bool LLSettingsSky::getIsSunUp() const
 {
     LLVector3 sunDir = getSunDirection();
-    return sunDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN;
+    return sunDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
 }
 
 bool LLSettingsSky::getIsMoonUp() const
 {
     LLVector3 moonDir = getMoonDirection();
-    return moonDir.mV[2] > 0;//NIGHTTIME_ELEVATION_SIN;
+    return moonDir.mV[2] > NIGHTTIME_ELEVATION_SIN;
 }
 
 void LLSettingsSky::calculateHeavenlyBodyPositions()  const
diff --git a/indra/llrender/llrendertarget.cpp b/indra/llrender/llrendertarget.cpp
index 08924dd536a5c382da230d4d213b5b8f9d4e7d7a..c6596338e00b2dee8a7446a9b03fe0a48946b1d5 100644
--- a/indra/llrender/llrendertarget.cpp
+++ b/indra/llrender/llrendertarget.cpp
@@ -286,7 +286,7 @@ bool LLRenderTarget::allocateDepth()
 		U32 internal_type = LLTexUnit::getInternalType(mUsage);
 		stop_glerror();
 		clear_glerror();
-		LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT32F, mResX, mResY, GL_DEPTH_COMPONENT, GL_FLOAT, NULL, false);
+		LLImageGL::setManualImage(internal_type, 0, GL_DEPTH_COMPONENT24, mResX, mResY, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, NULL, false);
 		gGL.getTexUnit(0)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
 	}
 
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f591782694a3f1c88c36254b8766b48fc8415000..bb5ff191762529f65cc48aca3c147458fcc04eba 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8763,7 +8763,7 @@
     <key>Type</key>
     <string>Boolean</string>
     <key>Value</key>
-    <integer>1</integer>
+    <integer>0</integer>
   </map>
   <key>RenderLocalLights</key>
   <map>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
index 379fdf8535e600d71c3c7a537691cea1dcda7e72..7265275e364b944e4757a6d5beccc93221d42215 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/moonF.glsl
@@ -61,7 +61,5 @@ void main()
     frag_data[0] = vec4(c.rgb, c.a);
     frag_data[1] = vec4(0.0);
     frag_data[2] = vec4(0.0f);
-
-    gl_FragDepth = 0.9998f;
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index f8172cae17e34fdd85a214b7e0a073357851e83b..06131116327c2f10de8b3256cfe9318bb7070535 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -44,20 +44,18 @@ vec3 scaleSoftClip(vec3 light);
 
 void main()
 {
-    // Potential Fill-rate optimization.  Add cloud calculation 
-    // back in and output alpha of 0 (so that alpha culling kills 
-    // the fragment) if the sky wouldn't show up because the clouds 
-    // are fully opaque.
-
-    vec4 color;
-    color = vary_HazeColor;
-    color *= 2.;
-
-    /// Gamma correct for WL (soft clip effect).
-    frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
-    frag_data[1] = vec4(0.0,0.0,0.0,0.0);
-    frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog
-
-    gl_FragDepth = 0.999f;
+	// Potential Fill-rate optimization.  Add cloud calculation 
+	// back in and output alpha of 0 (so that alpha culling kills 
+	// the fragment) if the sky wouldn't show up because the clouds 
+	// are fully opaque.
+
+	vec4 color;
+	color = vary_HazeColor;
+	color *= 2.;
+
+	/// Gamma correct for WL (soft clip effect).
+	frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0);
+	frag_data[1] = vec4(0.0,0.0,0.0,0.0);
+	frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog
 }
 
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index 531425b588c98acb8a1002174e5d163c38325877..40d4c24d342fce104a0da7766adec2c53b8c6f67 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -165,11 +165,11 @@ void main()
     
     color.rgb = atmosTransport(color.rgb);
     color.rgb = scaleSoftClipFrag(color.rgb);
-    color.a   = (water_edge > 0) ? 1.0 : (spec * sunAngle2);
+    color.a   = spec * sunAngle2;
 
     vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
 
-    frag_data[0] = vec4(color.rgb, 1); // diffuse
+    frag_data[0] = vec4(color.rgb, color); // diffuse
     frag_data[1] = vec4(0);     // speccolor, spec
     frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0
 }
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 7f82d38ced8c6eb92dc3a24bc1644eb333af7441..f9ab241988a577a67faeb637cb98c0cd00f0c509 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -248,7 +248,7 @@ void LLDrawPoolWLSky::renderSkyHazeDeferred(const LLVector3& camPosLocal, F32 ca
 
 	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_SKY))
 	{
-        LLGLSPipelineDepthTestSkyBox sky(true, true);
+        LLGLSPipelineDepthTestSkyBox sky(true, false);
 
         sky_shader->bind();
 
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 2445605f196ff2a5cc12da8ff7d99a1788a44ec4..2d4478bfdbb487d15ef6bacb5482dbeff8c9c37f 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -157,7 +157,6 @@ void display_startup()
 	LLGLState::checkStates();
 	LLGLState::checkTextureChannels();
 
-    glClearDepth(1.25f);
 	glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 	LLGLSUIDefault gls_ui;
 	gPipeline.disableLights();
@@ -753,7 +752,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 				LLGLState::checkClientArrays();
 
 			}
-            glClearDepth(1.25f);
 			glClear(GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
 		}