diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp
index fd187b99eecc12c0319c3d98c59d108df5ecae23..f00d97cd47318ca785ead1b9d585ded324af28a0 100644
--- a/indra/llrender/llshadermgr.cpp
+++ b/indra/llrender/llshadermgr.cpp
@@ -552,8 +552,8 @@ void LLShaderMgr::dumpObjectLog(GLhandleARB ret, BOOL warns, const std::string&
 
 	if (log.length() > 0)
 	{
-        LL_INFOS("ShaderErrors") << "Shader loading from " << fname << ":\n" << LL_ENDL;
-        LL_INFOS("ShaderErrors") << log << LL_ENDL;
+        LL_DEBUGS() << "Shader loading from " << fname << ":\n" << LL_ENDL;
+        LL_DEBUGS() << log << LL_ENDL;
 	}
  }
 
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index 951c8edcc76d8403780ce9abd9377c07151caada..670dfe2decf85e2bacd556efb11d2dc9741738c9 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -50,8 +50,8 @@
 						</array>
 					<key>tags</key>
 						<array>
+						     <string>ShaderErrors/string>
 						<!-- sample entry for debugging specific items	
-						     <string>ShaderLoading</string>
 						     <string>Avatar</string>
 						     <string>Inventory</string>
 						     <string>SceneLoadTiming</string>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 04237a6012124a22c532e9fe4145b8991c6b6dc1..8649484d2fdffef78bfc08fc67c758c4688d899d 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -6617,6 +6617,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>MouseMoon</key>
+    <map>
+      <key>Comment</key>
+      <string />
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
    <key>MuteAmbient</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..14b08b1da4476341855de1ffed46c8d25608ec8a
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonF.glsl
@@ -0,0 +1,58 @@
+/** 
+ * @file moonF.glsl
+ *
+ * $LicenseInfo:firstyear=2005&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2005, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+ 
+#extension GL_ARB_texture_rectangle : enable
+
+/*[EXTRA_CODE_HERE]*/
+
+#ifdef DEFINE_GL_FRAGCOLOR
+out vec4 frag_color;
+#else
+#define frag_color gl_FragColor
+#endif
+
+vec3 fullbrightAtmosTransport(vec3 light);
+vec3 fullbrightScaleSoftClip(vec3 light);
+
+uniform vec4 color;
+uniform vec4 sunlight_color;
+uniform vec3 lumWeights;
+uniform float minLuminance;
+uniform sampler2D diffuseMap;
+VARYING vec2 vary_texcoord0;
+
+void main() 
+{
+	vec4 c = texture2D(diffuseMap, vary_texcoord0.xy);
+	c.rgb = fullbrightAtmosTransport(c.rgb);
+    c.rgb = fullbrightScaleSoftClip(c.rgb);
+    c.rgb = pow(c.rgb, vec3(0.45f));
+    // mix factor which blends when sunlight is brighter
+    // and shows true moon color at night
+    float mix = dot(normalize(sunlight_color.rgb), lumWeights);
+    mix = smoothstep(-0.5f, 2.0f, lum);
+	frag_color = vec4(c.rgb, mix * c.a);
+}
+
diff --git a/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
new file mode 100644
index 0000000000000000000000000000000000000000..7c4dfbd999728bd8d0d0b4b179a1851d53b48d26
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/windlight/moonV.glsl
@@ -0,0 +1,48 @@
+/** 
+ * @file moonV.glsl
+ *
+  * $LicenseInfo:firstyear=2007&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2007, Linden Research, Inc.
+ * 
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2.1 of the License only.
+ * 
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ * 
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ * 
+ * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
+ * $/LicenseInfo$
+ */
+
+uniform mat4 texture_matrix0;
+uniform mat4 modelview_matrix;
+uniform mat4 modelview_projection_matrix;
+
+ATTRIBUTE vec3 position;
+ATTRIBUTE vec2 texcoord0;
+
+//void calcAtmospherics(vec3 inPositionEye);
+
+VARYING vec2 vary_texcoord0;
+
+void main()
+{
+	//transform vertex
+	vec4 vert = vec4(position.xyz, 1.0);
+	vec4 pos = (modelview_matrix * vert);
+
+	gl_Position = modelview_projection_matrix*vec4(position.xyz, 1.0);
+	
+	vary_texcoord0 = (texture_matrix0 * vec4(texcoord0,0,1)).xy;
+	
+	//calcAtmospherics(pos.xyz);
+}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index c6abba95bc7ba31e2b15a70e0901e2e1bf9cdf35..7a7739da03f7fb25772fde0658fb6d0b7e495ccc 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -52,7 +52,7 @@ LLPointer<LLImageRaw> LLDrawPoolWLSky::sCloudNoiseRawImage = NULL;
 
 static LLGLSLShader* cloud_shader = NULL;
 static LLGLSLShader* sky_shader = NULL;
-
+static LLGLSLShader* moon_shader = NULL;
 
 LLDrawPoolWLSky::LLDrawPoolWLSky(void) :
 	LLDrawPool(POOL_WL_SKY)
@@ -109,6 +109,11 @@ void LLDrawPoolWLSky::beginRenderPass( S32 pass )
 			LLPipeline::sUnderWaterRender ?
 				&gObjectFullbrightNoColorWaterProgram :
 				&gWLCloudProgram;
+
+    moon_shader =
+			LLPipeline::sUnderWaterRender ?
+				&gObjectFullbrightNoColorWaterProgram :
+				&gWLMoonProgram;
 }
 
 void LLDrawPoolWLSky::endRenderPass( S32 pass )
@@ -275,6 +280,7 @@ void LLDrawPoolWLSky::renderStars(void) const
 
 void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeightLocal) const
 {
+#if REMOVE_BEFORE_FLIGHT
 	if (gPipeline.canUseWindLightShaders() && gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_CLOUDS) && sCloudNoiseTexture.notNull())
 	{
 		LLGLEnable blend(GL_BLEND);
@@ -289,6 +295,7 @@ void LLDrawPoolWLSky::renderSkyClouds(const LLVector3& camPosLocal, F32 camHeigh
 
 		cloud_shader->unbind();
 	}
+#endif
 }
 
 void LLDrawPoolWLSky::renderHeavenlyBodies()
@@ -311,7 +318,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
 
 	LLFace * face = gSky.mVOSkyp->mFace[LLVOSky::FACE_MOON];
 
-	if (gSky.mVOSkyp->getMoon().getDraw() && face->getGeomCount())
+	if (gSky.mVOSkyp->getMoon().getDraw() && face->getGeomCount() && moon_shader)
 	{
 		// *NOTE: even though we already bound this texture above for the
 		// stars register combiners, we bind again here for defensive reasons,
@@ -328,8 +335,9 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
 		
 		if (gPipeline.canUseVertexShaders())
 		{
-			gHighlightProgram.bind();
-            gHighlightProgram.uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
+			moon_shader->bind();
+            moon_shader->uniform4fv(LLShaderMgr::DIFFUSE_COLOR, 1, color.mV);
+            moon_shader->uniform3fv(LLShaderMgr::GLOW_LUM_WEIGHTS, 1, LLPipeline::RenderGlowLumWeights.mV);
 		}
 
 		LLFacePool::LLOverrideFaceColor color_override(this, color);
@@ -338,7 +346,7 @@ void LLDrawPoolWLSky::renderHeavenlyBodies()
 
 		if (gPipeline.canUseVertexShaders())
 		{
-			gHighlightProgram.unbind();
+			moon_shader->unbind();
 		}
 	}
 }
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 41fe206ada9210855783873e6a13a66699394c30..bb108fa6ac3815e95c8b5828548b275fa30ba16a 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -136,6 +136,20 @@ void LLSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLV
 	}
 }
 
+void LLSky::setSunDirectionCFR(const LLVector3 &sun_direction)
+{
+    if(mVOSkyp.notNull()) {
+        mVOSkyp->setSunDirectionCFR(sun_direction);
+	}
+}
+
+void LLSky::setMoonDirectionCFR(const LLVector3 &moon_direction)
+{
+    if(mVOSkyp.notNull()) {
+        mVOSkyp->setMoonDirectionCFR(moon_direction);
+	}
+}
+
 //////////////////////////////////////////////////////////////////////
 // Public Methods
 //////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index 8e868534812de1973bac1ea9572eb87cdd1c5c1b..4b3b06b33f7979ae19574a8059d478fc12d9c22c 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -53,6 +53,8 @@ class LLSky
 
     // These directions should be in CFR coord sys (+x at, +z up, +y right)
     void setSunAndMoonDirectionsCFR(const LLVector3 &sun_direction, const LLVector3 &moon_direction);
+    void setSunDirectionCFR(const LLVector3 &sun_direction);
+    void setMoonDirectionCFR(const LLVector3 &moon_direction);
 
 	LLColor4 getSkyFogColor() const;
 
diff --git a/indra/newview/lltoolgun.cpp b/indra/newview/lltoolgun.cpp
index fb96804bfa019e3bcaa20c45c5bb88200687b156..ee757f2566ee8526d1abff26f29b736dbad462e0 100644
--- a/indra/newview/lltoolgun.cpp
+++ b/indra/newview/lltoolgun.cpp
@@ -108,7 +108,14 @@ BOOL LLToolGun::handleHover(S32 x, S32 y, MASK mask)
 			if (gSavedSettings.getBOOL("MouseSun"))
 			{
                 LLVector3 sunpos = LLViewerCamera::getInstance()->getAtAxis();
-				gSky.setSunAndMoonDirectionsCFR(sunpos, -sunpos);
+				gSky.setSunDirectionCFR(sunpos);
+				gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
+			}
+
+            if (gSavedSettings.getBOOL("MouseMoon"))
+			{
+                LLVector3 moonpos = LLViewerCamera::getInstance()->getAtAxis();
+				gSky.setMoonDirectionCFR(moonpos);
 				gSavedSettings.setVector3("SkySunDefaultPosition", LLViewerCamera::getInstance()->getAtAxis());
 			}
 
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index 820e18290f6ec7c8f8f7696be5e0e739cc8a7139..48c72d8dc0002e574017819a9b120672d8d04580 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -176,7 +176,7 @@ LLGLSLShader		gImpostorProgram;
 // WindLight shader handles
 LLGLSLShader			gWLSkyProgram;
 LLGLSLShader			gWLCloudProgram;
-
+LLGLSLShader			gWLMoonProgram;
 
 // Effects Shaders
 LLGLSLShader			gGlowProgram;
@@ -250,6 +250,7 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
 	//ONLY shaders that need WL Param management should be added here
 	mShaderList.push_back(&gWLSkyProgram);
 	mShaderList.push_back(&gWLCloudProgram);
+    mShaderList.push_back(&gWLMoonProgram);
 	mShaderList.push_back(&gAvatarProgram);
 	mShaderList.push_back(&gObjectShinyProgram);
 	mShaderList.push_back(&gObjectShinyNonIndexedProgram);
@@ -828,6 +829,7 @@ void LLViewerShaderMgr::unloadShaders()
 
 	gWLSkyProgram.unload();
 	gWLCloudProgram.unload();
+    gWLMoonProgram.unload();
 
 	gPostColorFilterProgram.unload();
 	gPostNightVisionProgram.unload();
@@ -3480,6 +3482,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
 	{
 		gWLSkyProgram.unload();
 		gWLCloudProgram.unload();
+        gWLMoonProgram.unload();
 		gDownsampleMinMaxDepthRectProgram.unload();
         gInscatterRectProgram.unload();
 		return TRUE;
@@ -3503,7 +3506,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
 		success = gWLSkyProgram.createShader(NULL, NULL);
 	}
 
-	if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+	if (success)
 	{
 		gWLCloudProgram.mName = "Windlight Cloud Program";
 		//gWLCloudProgram.mFeatures.hasGamma = true;
@@ -3515,6 +3518,24 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
 		success = gWLCloudProgram.createShader(NULL, NULL);
 	}
 
+    if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
+	{
+		gWLMoonProgram.mName = "Windlight Moon Program";
+		gWLMoonProgram.mShaderFiles.clear();
+		gWLMoonProgram.mFeatures.calculatesAtmospherics = true;
+		gWLMoonProgram.mFeatures.hasTransport = true;
+        gWLMoonProgram.mFeatures.hasGamma = true;
+		gWLMoonProgram.mFeatures.hasAtmospherics = true;
+        gWLMoonProgram.mFeatures.isFullbright = true;
+		gWLMoonProgram.mFeatures.disableTextureIndex = true;
+		gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+		gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonV.glsl", GL_VERTEX_SHADER_ARB));
+		gWLMoonProgram.mShaderFiles.push_back(make_pair("windlight/moonF.glsl", GL_FRAGMENT_SHADER_ARB));
+		gWLMoonProgram.mShaderLevel = mVertexShaderLevel[SHADER_WINDLIGHT];
+		gWLMoonProgram.mShaderGroup = LLGLSLShader::SG_SKY;
+		success = gWLMoonProgram.createShader(NULL, NULL);
+	}
+
 	return success;
 }
 
diff --git a/indra/newview/llviewershadermgr.h b/indra/newview/llviewershadermgr.h
index 10c60187f31b585abcef31c7ccb2d2005826a0c5..d4967ca5a559556ca162c50bf14a6e92b51ebda7 100644
--- a/indra/newview/llviewershadermgr.h
+++ b/indra/newview/llviewershadermgr.h
@@ -279,6 +279,7 @@ extern LLGLSLShader			gImpostorProgram;
 // WindLight shader handles
 extern LLGLSLShader			gWLSkyProgram;
 extern LLGLSLShader			gWLCloudProgram;
+extern LLGLSLShader			gWLMoonProgram;
 
 // Post Process Shaders
 extern LLGLSLShader			gPostColorFilterProgram;
diff --git a/indra/newview/llvosky.cpp b/indra/newview/llvosky.cpp
index fc83218b1ac1e8f70edf51d45b864d3e6ebd46da..6d066ecfd9e8d59612863b321b43da8cb029b759 100644
--- a/indra/newview/llvosky.cpp
+++ b/indra/newview/llvosky.cpp
@@ -1354,3 +1354,39 @@ void LLVOSky::setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir_cfr, const LLV
 
     LLSkyTex::stepCurrent();
 }
+
+void LLVOSky::setSunDirectionCFR(const LLVector3 &sun_dir_cfr)
+{
+    mSun.setDirection(sun_dir_cfr);	
+
+	mLastLightingDirection = mSun.getDirection();
+
+	// Push the sun "South" as it approaches directly overhead so that we can always see bump mapping
+	// on the upward facing faces of cubes.
+    {
+	    // Same as dot product with the up direction + clamp.
+	    F32 sunDot = llmax(0.f, sun_dir_cfr.mV[2]);
+	    sunDot *= sunDot;	
+
+	    // Create normalized vector that has the sunDir pushed south about an hour and change.
+	    LLVector3 adjustedDir = (sun_dir_cfr + LLVector3(0.f, -0.70711f, 0.70711f)) * 0.5f;
+
+	    // Blend between normal sun dir and adjusted sun dir based on how close we are
+	    // to having the sun overhead.
+	    mBumpSunDir = adjustedDir * sunDot + sun_dir_cfr * (1.0f - sunDot);
+	    mBumpSunDir.normalize();
+    }
+
+	updateDirections();
+
+    LLSkyTex::stepCurrent();
+}
+
+void LLVOSky::setMoonDirectionCFR(const LLVector3 &moon_dir_cfr)
+{
+	mMoon.setDirection(moon_dir_cfr);
+
+	updateDirections();
+
+    LLSkyTex::stepCurrent();
+}
diff --git a/indra/newview/llvosky.h b/indra/newview/llvosky.h
index 4de3d120684877cd7c928165a6b16d7eb3882745..3d77c3f8e9a94d52040b85343cf808362ecf6025 100644
--- a/indra/newview/llvosky.h
+++ b/indra/newview/llvosky.h
@@ -239,6 +239,8 @@ class LLVOSky : public LLStaticViewerObject
 
     // directions provided should already be in CFR coord sys (+x at, +z up, +y right)
     void setSunAndMoonDirectionsCFR(const LLVector3 &sun_dir, const LLVector3 &moon_dir);
+    void setSunDirectionCFR(const LLVector3 &sun_direction);
+    void setMoonDirectionCFR(const LLVector3 &moon_direction);
 
 	bool updateHeavenlyBodyGeometry(LLDrawable *drawable, const S32 side, LLHeavenBody& hb, const LLVector3 &up, const LLVector3 &right);
 	void updateReflectionGeometry(LLDrawable *drawable, F32 H, const LLHeavenBody& HB);