diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index d7b90e0691939008d4d5e9e648b655ff12116a16..94ce4f6df7863e04d772b8316df9aa5e2f9376f8 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -14805,6 +14805,28 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>sunbeacon</key>
+    <map>
+      <key>Comment</key>
+      <string>Show direction to the Sun</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
+    <key>moonbeacon</key>
+    <map>
+      <key>Comment</key>
+      <string>Show direction to the Moon</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>ShowDeviceSettings</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llglsandbox.cpp b/indra/newview/llglsandbox.cpp
index a9b15fc8b6296aa507bfd2759a6475a628db8aa2..eb417106b66d1c4ef499b379c01177d2cd6ecb3b 100644
--- a/indra/newview/llglsandbox.cpp
+++ b/indra/newview/llglsandbox.cpp
@@ -44,6 +44,7 @@
 #include "llviewercamera.h"
 
 #include "llvoavatarself.h"
+#include "llsky.h"
 #include "llagent.h"
 #include "lltoolmgr.h"
 #include "llselectmgr.h"
@@ -771,6 +772,16 @@ void draw_line_cube(F32 width, const LLVector3& center)
 	gGL.vertex3f(center.mV[VX] + width ,center.mV[VY] - width,center.mV[VZ] - width);
 }
 
+void draw_cross_lines(const LLVector3& center, F32 dx, F32 dy, F32 dz)
+{
+	gGL.vertex3f(center.mV[VX] - dx, center.mV[VY], center.mV[VZ]);
+	gGL.vertex3f(center.mV[VX] + dx, center.mV[VY], center.mV[VZ]);
+	gGL.vertex3f(center.mV[VX], center.mV[VY] - dy, center.mV[VZ]);
+	gGL.vertex3f(center.mV[VX], center.mV[VY] + dy, center.mV[VZ]);
+	gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] - dz);
+	gGL.vertex3f(center.mV[VX], center.mV[VY], center.mV[VZ] + dz);
+}
+
 void LLViewerObjectList::renderObjectBeacons()
 {
 	if (mDebugBeacons.empty())
@@ -808,13 +819,7 @@ void LLViewerObjectList::renderObjectBeacons()
 		
 			gGL.begin(LLRender::LINES);
 			gGL.color4fv(color.mV);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 50.f);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 50.f);
-			gGL.vertex3f(thisline.mV[VX] - 2.f,thisline.mV[VY],thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX] + 2.f,thisline.mV[VY],thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 2.f,thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 2.f,thisline.mV[VZ]);
-
+			draw_cross_lines(thisline, 2.0f, 2.0f, 50.f);
 			draw_line_cube(0.10f, thisline);
 			
 			gGL.end();
@@ -843,13 +848,7 @@ void LLViewerObjectList::renderObjectBeacons()
 			const LLVector3 &thisline = debug_beacon.mPositionAgent;
 			gGL.begin(LLRender::LINES);
 			gGL.color4fv(debug_beacon.mColor.mV);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] - 0.5f);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY],thisline.mV[VZ] + 0.5f);
-			gGL.vertex3f(thisline.mV[VX] - 0.5f,thisline.mV[VY],thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX] + 0.5f,thisline.mV[VY],thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] - 0.5f,thisline.mV[VZ]);
-			gGL.vertex3f(thisline.mV[VX],thisline.mV[VY] + 0.5f,thisline.mV[VZ]);
-
+			draw_cross_lines(thisline, 0.5f, 0.5f, 0.5f);
 			draw_line_cube(0.10f, thisline);
 
 			gGL.end();
@@ -880,6 +879,34 @@ void LLViewerObjectList::renderObjectBeacons()
 	}
 }
 
+void LLSky::renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color)
+{
+	LLGLSUIDefault gls_ui;
+	if (LLGLSLShader::sNoFixedFunction)
+	{
+		gUIProgram.bind();
+	}
+	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
+
+	LLVector3 pos_end;
+	for (S32 i = 0; i < 3; ++i)
+	{
+		pos_end.mV[i] = pos_agent.mV[i] + (50 * direction.mV[i]);
+	}
+	glLineWidth(LLPipeline::DebugBeaconLineWidth);
+	gGL.begin(LLRender::LINES);
+	color.mV[3] *= 0.5f;
+	gGL.color4fv(color.mV);
+	draw_cross_lines(pos_agent, 0.5f, 0.5f, 0.5f);
+	draw_cross_lines(pos_end, 2.f, 2.f, 2.f);
+	gGL.vertex3fv(pos_agent.mV);
+	gGL.vertex3fv(pos_end.mV);
+	gGL.end();
+
+	gGL.flush();
+	glLineWidth(1.f);
+
+}
 
 //-----------------------------------------------------------------------------
 // gpu_benchmark() helper classes
diff --git a/indra/newview/llsky.cpp b/indra/newview/llsky.cpp
index 0740878901eebe913f6c551d8c7230ad2e154585..71de99b4eca8691f04327af4b1fc89f9199b2e56 100644
--- a/indra/newview/llsky.cpp
+++ b/indra/newview/llsky.cpp
@@ -52,7 +52,7 @@
 #include "llcubemap.h"
 #include "llviewercontrol.h"
 #include "llenvironment.h"
-
+#include "llvoavatarself.h"
 #include "llvowlsky.h"
 
 F32 azimuth_from_vector(const LLVector3 &v);
@@ -234,6 +234,23 @@ void LLSky::setWind(const LLVector3& average_wind)
 	}
 }
 
+void LLSky::addSunMoonBeacons()
+{	
+	if (!gAgentAvatarp || !mVOSkyp) return;
+
+	static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
+	static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
+
+	if (show_sun_beacon)
+	{
+		renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getSun().getDirection(), LLColor4(1.f, 0.5f, 0.f, 0.5f));
+	}
+	if (show_moon_beacon)
+	{
+		renderSunMoonBeacons(gAgentAvatarp->getPositionAgent(), mVOSkyp->getMoon().getDirection(), LLColor4(1.f, 0.f, 0.8f, 0.5f));
+	}
+}
+
 //////////////////////////////////////////////////////////////////////
 // Private Methods
 //////////////////////////////////////////////////////////////////////
diff --git a/indra/newview/llsky.h b/indra/newview/llsky.h
index e3cc56788822f3cb772c763e38b16ce6a8450fe0..8c0d70c16c93d3b310febd87a3b4fb75748e8c8b 100644
--- a/indra/newview/llsky.h
+++ b/indra/newview/llsky.h
@@ -84,6 +84,9 @@ class LLSky
 	void restoreGL();
 	void resetVertexBuffers();
 
+	void addSunMoonBeacons();
+	void renderSunMoonBeacons(const LLVector3& pos_agent, const LLVector3& direction, LLColor4 color);
+
 public:
 	LLPointer<LLVOSky>		mVOSkyp;	// Pointer to the LLVOSky object (only one, ever!)
 	LLPointer<LLVOGround>	mVOGroundp;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 00189f0b1108c63120ea7b18f57dd6419e95b14b..6e500f79626bbe8c6ffa4803173f7f5130dcfee4 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -8258,6 +8258,14 @@ class LLViewToggleBeacon : public view_listener_t
 				gSavedSettings.setBOOL( "scriptsbeacon", LLPipeline::getRenderScriptedBeacons() );
 			}
 		}
+		else if (beacon == "sunbeacon")
+		{
+			gSavedSettings.setBOOL("sunbeacon", !gSavedSettings.getBOOL("sunbeacon"));
+		}
+		else if (beacon == "moonbeacon")
+		{
+			gSavedSettings.setBOOL("moonbeacon", !gSavedSettings.getBOOL("moonbeacon"));
+		}
 		else if (beacon == "renderbeacons")
 		{
 			LLPipeline::toggleRenderBeacons();
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 26678775fb0421ac37c3b6ab31765afa87427001..9be2e905a2aa6f66371ccbb53852cafe77b07263 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -357,6 +357,8 @@ class LLDebugText
 		static const std::string beacon_scripted_touch = LLTrans::getString("BeaconScriptedTouch");
 		static const std::string beacon_sound = LLTrans::getString("BeaconSound");
 		static const std::string beacon_media = LLTrans::getString("BeaconMedia");
+		static const std::string beacon_sun = LLTrans::getString("BeaconSun");
+		static const std::string beacon_moon = LLTrans::getString("BeaconMoon");
 		static const std::string particle_hiding = LLTrans::getString("ParticleHiding");
 
 		// Draw the statistics in a light gray
@@ -791,6 +793,20 @@ class LLDebugText
 			}
 		}
 
+		static LLUICachedControl<bool> show_sun_beacon("sunbeacon", false);
+		static LLUICachedControl<bool> show_moon_beacon("moonbeacon", false);
+
+		if (show_sun_beacon)
+		{
+			addText(xpos, ypos, beacon_sun);
+			ypos += y_inc;
+		}
+		if (show_moon_beacon)
+		{
+			addText(xpos, ypos, beacon_moon);
+			ypos += y_inc;
+		}
+
 		if(log_texture_traffic)
 		{	
 			U32 old_y = ypos ;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index cd2146ab4e0f21f896ad457d217fa70e4aac6257..7cb6d37cffdeddb626ef382914dd0a534be50893 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4578,6 +4578,7 @@ void LLPipeline::renderGeom(LLCamera& camera, bool forceVBOUpdate)
 				// Render debugging beacons.
 				gObjectList.renderObjectBeacons();
 				gObjectList.resetObjectBeacons();
+				gSky.addSunMoonBeacons();
 			}
 			else
 			{
@@ -9078,6 +9079,7 @@ void LLPipeline::renderDeferredLighting()
 			// Render debugging beacons.
 			gObjectList.renderObjectBeacons();
 			gObjectList.resetObjectBeacons();
+			gSky.addSunMoonBeacons();
 		}
 	}
 
diff --git a/indra/newview/skins/default/xui/en/floater_beacons.xml b/indra/newview/skins/default/xui/en/floater_beacons.xml
index 3d29356b2256a4de0d43e2a3e4406c00c375d1c1..d5947fc0af8b016eeccb091ef6716df2e5f9d582 100644
--- a/indra/newview/skins/default/xui/en/floater_beacons.xml
+++ b/indra/newview/skins/default/xui/en/floater_beacons.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- height="245"
+ height="310"
  layout="topleft"
  name="beacons"
  help_topic="beacons"
@@ -12,7 +12,7 @@
  width="240">
     <panel
      follows="left|top|right|bottom"
-     height="240"
+     height="305"
      layout="topleft"
      left="10"
      name="beacons_panel"
@@ -143,6 +143,43 @@
           <check_box.commit_callback
            function="Beacons.UICheck" />
         </check_box>
+        <view_border
+         bevel_style="in"
+         height="0"
+         layout="topleft"
+         left="0"
+         name="cost_text_border"
+         top_pad="5"
+         width="220"/>
+        <text
+         follows="all"
+         height="16"
+         font="SansSerif"
+         left="0"
+         top_pad="7"
+         name="label_objects"
+         text_color="White"
+         type="string">
+           Show direction to:
+         </text>
+        <check_box
+         control_name="sunbeacon"
+         height="16"
+         label="Sun"
+         layout="topleft"
+         name="sun" >
+          <check_box.commit_callback
+           function="Beacons.UICheck" />
+        </check_box>
+        <check_box
+         control_name="moonbeacon"
+         height="16"
+         label="Moon"
+         layout="topleft"
+         name="moon" >
+          <check_box.commit_callback
+           function="Beacons.UICheck" />
+        </check_box>
 
     </panel>
 </floater>
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 33c2224b9ddfe9ea9834911ee91899ab737ae90c..10e98719a43767d30de30dc5b2fd1d8776ddabe4 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -4094,6 +4094,8 @@ Try enclosing path to the editor with double quotes.
   <string name="BeaconScriptedTouch">Viewing scripted object with touch function beacons (red)</string>
   <string name="BeaconSound">Viewing sound beacons (yellow)</string>
   <string name="BeaconMedia">Viewing media beacons (white)</string>
+  <string name="BeaconSun">Viewing sun direction beacon (orange)</string>
+  <string name="BeaconMoon">Viewing moon direction beacon (purple)</string>
   <string name="ParticleHiding">Hiding Particles</string>
 
   <!-- commands -->