diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 0b943d2527126c6734927b4d8953d6ecdc2b09a4..cbc19bbba34476a4811f655ca22eabade9d3bf80 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -40,10 +40,12 @@ VARYING vec2 vary_fragcoord;
 
 uniform float display_gamma;
 
+vec3 linear_to_srgb(vec3 cl);
+
 void main() 
 {
-    vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
-    diff.rgb = pow(diff.rgb, vec3(display_gamma));
-    frag_color = diff;
+	vec4 diff = texture2DRect(diffuseRect, vary_fragcoord);
+	diff.rgb = linear_to_srgb(diff.rgb);
+	frag_color = diff;
 }
 
diff --git a/indra/newview/llpanelenvironment.cpp b/indra/newview/llpanelenvironment.cpp
index a324dfb93b1b91cbc7b28e8c75034f5d2966f836..abd19131858669bed9cd765137da6401817bf0cb 100644
--- a/indra/newview/llpanelenvironment.cpp
+++ b/indra/newview/llpanelenvironment.cpp
@@ -68,6 +68,7 @@ namespace
 const std::string LLPanelEnvironmentInfo::BTN_SELECTINV("btn_select_inventory");
 const std::string LLPanelEnvironmentInfo::BTN_EDIT("btn_edit");
 const std::string LLPanelEnvironmentInfo::BTN_USEDEFAULT("btn_usedefault");
+const std::string LLPanelEnvironmentInfo::BTN_RST_ALTITUDES("btn_rst_altitudes");
 const std::string LLPanelEnvironmentInfo::SLD_DAYLENGTH("sld_day_length");
 const std::string LLPanelEnvironmentInfo::SLD_DAYOFFSET("sld_day_offset");
 const std::string LLPanelEnvironmentInfo::SLD_ALTITUDES("sld_altitudes");
@@ -105,6 +106,7 @@ const U32 LLPanelEnvironmentInfo::DIRTY_FLAG_MASK(
         LLPanelEnvironmentInfo::DIRTY_FLAG_ALTITUDES);
 
 const U32 ALTITUDE_SLIDER_COUNT = 3;
+const F32 ALTITUDE_DEFAULT_HEIGHT_STEP = 1000;
 
 const std::string alt_sliders[] = {
     "sld1",
@@ -161,6 +163,7 @@ BOOL LLPanelEnvironmentInfo::postBuild()
     getChild<LLUICtrl>(BTN_USEDEFAULT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnDefault(); });
     getChild<LLUICtrl>(BTN_SELECTINV)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnSelect(); });
     getChild<LLUICtrl>(BTN_EDIT)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnEdit(); });
+    getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setCommitCallback([this](LLUICtrl *, const LLSD &){ onBtnRstAltitudes(); });
 
     getChild<LLUICtrl>(SLD_DAYLENGTH)->setCommitCallback([this](LLUICtrl *, const LLSD &value) { onSldDayLengthChanged(value.asReal()); });
     getChild<LLSliderCtrl>(SLD_DAYLENGTH)->setSliderMouseUpCallback([this](LLUICtrl *, const LLSD &) { onDayLenOffsetMouseUp(); });
@@ -428,6 +431,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
     getChild<LLUICtrl>(PNL_DISABLED)->setVisible(false);
 
     getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setVisible(LLEnvironment::instance().isExtendedEnvironmentEnabled());
+    getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setVisible(isRegion());
 
     bool can_enable = enabled && mCurrentEnvironment && (mCurEnvVersion != INVALID_PARCEL_ENVIRONMENT_VERSION);
     getChild<LLUICtrl>(BTN_SELECTINV)->setEnabled(can_enable && !is_legacy);
@@ -437,6 +441,7 @@ bool LLPanelEnvironmentInfo::setControlsEnabled(bool enabled)
     getChild<LLUICtrl>(SLD_DAYOFFSET)->setEnabled(can_enable && !is_legacy);
     getChild<LLUICtrl>(SLD_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy);
     getChild<LLUICtrl>(ICN_GROUND)->setColor((can_enable && isRegion() && !is_legacy) ? LLColor4::white : LLColor4::grey % 0.8f);
+    getChild<LLUICtrl>(BTN_RST_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy);
     getChild<LLUICtrl>(PNL_ENVIRONMENT_ALTITUDES)->setEnabled(can_enable && isRegion() && !is_legacy);
     getChild<LLUICtrl>(CHK_ALLOWOVERRIDE)->setEnabled(can_enable && isRegion() && !is_legacy);
 
@@ -689,6 +694,24 @@ void LLPanelEnvironmentInfo::onBtnSelect()
     }
 }
 
+void LLPanelEnvironmentInfo::onBtnRstAltitudes()
+{
+    if (isRegion())
+    {
+        LLHandle<LLPanel> that_h = getHandle();
+        LLEnvironment::altitudes_vect_t alts;
+
+        for (S32 idx = 1; idx <= ALTITUDE_SLIDER_COUNT; ++idx)
+        {
+            F32 new_height = idx * ALTITUDE_DEFAULT_HEIGHT_STEP;
+            alts.push_back(new_height);
+        }
+
+        LLEnvironment::instance().updateParcel(getParcelId(), LLSettingsDay::ptr_t(),
+            -1, -1, alts,
+            [that_h](S32 parcel_id, LLEnvironment::EnvironmentInfo::ptr_t envifo) { _onEnvironmentReceived(that_h, parcel_id, envifo); });
+    }
+}
 
 void LLPanelEnvironmentInfo::udpateApparentTimeOfDay()
 {
diff --git a/indra/newview/llpanelenvironment.h b/indra/newview/llpanelenvironment.h
index dd3a309780b885a916448d4e424b9401ca0c6b6c..18ab64dc12b6f5f3906d9779535799f814a78729 100644
--- a/indra/newview/llpanelenvironment.h
+++ b/indra/newview/llpanelenvironment.h
@@ -66,6 +66,7 @@ class LLPanelEnvironmentInfo : public LLPanel
     static const std::string    BTN_SELECTINV;
     static const std::string    BTN_EDIT;
     static const std::string    BTN_USEDEFAULT;
+    static const std::string    BTN_RST_ALTITUDES;
     static const std::string    SLD_DAYLENGTH;
     static const std::string    SLD_DAYOFFSET;
     static const std::string    SLD_ALTITUDES;
@@ -117,6 +118,7 @@ class LLPanelEnvironmentInfo : public LLPanel
     void                        onBtnEdit();
     void                        onBtnSelect();
     void                        onBtnDefault();
+    void                        onBtnRstAltitudes();
 
     void                        udpateApparentTimeOfDay();
 
diff --git a/indra/newview/llscriptruntimeperms.h b/indra/newview/llscriptruntimeperms.h
index 51f57afdc91a2f94a0df3dea63d09f6a51ccb3e6..f692c0ad013c868673d6dd4446b6eb584ced0559 100644
--- a/indra/newview/llscriptruntimeperms.h
+++ b/indra/newview/llscriptruntimeperms.h
@@ -37,7 +37,7 @@ typedef struct _script_perm {
 	question(q), permbit(b), caution(c) {}
 } script_perm_t;
 
-const U32 NUM_SCRIPT_PERMISSIONS = 16;
+const U32 NUM_SCRIPT_PERMISSIONS = 18;
 const S32 SCRIPT_PERMISSION_DEBIT = 0;
 const S32 SCRIPT_PERMISSION_TRIGGER_ANIMATION = 3;
 const S32 SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS = 14;
@@ -58,7 +58,9 @@ static const boost::array<script_perm_t, NUM_SCRIPT_PERMISSIONS> SCRIPT_PERMISSI
 	_script_perm("JoinAnExperience",	(0x1 << 13), false),
 	_script_perm("SilentlyManageEstateAccess", (0x1 << 14), false),
 	_script_perm("OverrideYourAnimations", (0x1 << 15), false),
-	_script_perm("ScriptReturnObjects",	(0x1 << 16), false)
-}};
+	_script_perm("ScriptReturnObjects",	(0x1 << 16), false),
+    _script_perm("ForceSitAvatar",      (0x1 << 17), false),
+    _script_perm("ChangeEnvSettings",   (0x1 << 18), false)
+    } };
 
 #endif // LL_LLSCRIPTRUNTIME_PERMS_H
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6b1a0a2b777dcff1c92542f8f75c268316d6b1c6..e2e7aadb61e2fb4acc722e7624004eac6d608e75 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -662,7 +662,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
 {
     LLGLSLShader *shader = (LLGLSLShader *)ptarget;
 
-    LLVector4 light_direction = LLEnvironment::instance().getClampedSunNorm();
+    LLVector4 light_direction = LLEnvironment::instance().getClampedLightNorm();
 
     if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
 	{        
@@ -678,8 +678,11 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
         shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV);
 	}
 
+    F32 g = getGamma();
+
     shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength);
-    shader->uniform4f(LLShaderMgr::GAMMA, getGamma(), 0.0, 0.0, 1.0);
+    shader->uniform4f(LLShaderMgr::GAMMA, g, 0.0, 0.0, 1.0);
+    shader->uniform1f(LLShaderMgr::DISPLAY_GAMMA, g);
 }
 
 LLSettingsSky::parammapping_t LLSettingsVOSky::getParameterMap() const
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index eaa67e67556e1c52fa13131597fbfca538eeacc2..0597347ca80bba35cb3f70039a535c15e93ab4b9 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -5763,19 +5763,16 @@ void process_script_question(LLMessageSystem *msg, void **user_data)
 				// check whether permission question should cause special caution dialog
 				caution |= (script_perm.caution);
 
-				if (("ScriptTakeMoney" == script_perm.question) && has_not_only_debit)
+				if ((("ScriptTakeMoney" == script_perm.question) && has_not_only_debit) ||
+                        (script_perm.question == "JoinAnExperience"))
 					continue;
 
-                if (script_perm.question == "JoinAnExperience")
-                { // Some experience only permissions do not have an explicit permission bit.  Add them here.
-                    script_question += "    " + LLTrans::getString("ForceSitAvatar") + "\n";
-                    script_question += "    " + LLTrans::getString("ChangeEnvSettings") + "\n";
-                }
-
 				script_question += "    " + LLTrans::getString(script_perm.question) + "\n";
 			}
 		}
 	
+        script_question += "\n";
+
 		args["QUESTIONS"] = script_question;
 
 		if (known_questions != questions)
diff --git a/indra/newview/skins/default/xui/en/panel_region_environment.xml b/indra/newview/skins/default/xui/en/panel_region_environment.xml
index eac444c971d1f08c6886305ad66794e1e04b27fe..a39973fe3add5508e2f8c261ad44d9ea79234e05 100644
--- a/indra/newview/skins/default/xui/en/panel_region_environment.xml
+++ b/indra/newview/skins/default/xui/en/panel_region_environment.xml
@@ -203,6 +203,16 @@
                                 tool_tip="Drag a setting from Inventory onto this target box to select it as current water."
                                 width="155" />
                     </panel>
+                    <button
+                            follows="top|left"
+                            layout="topleft"
+                            height="23"
+                            width="100"
+                            label="Reset"
+                            left_pad="-90"
+                            top_pad="4"
+                            tool_tip="Reset to default altitudes"
+                            name="btn_rst_altitudes" />
                     <panel
                          follows="top|left"
                          height="21"
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 10e98719a43767d30de30dc5b2fd1d8776ddabe4..1879ce6f32963d3948ac7aad3efd7d7e2cb60e63 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -4219,6 +4219,8 @@ Try enclosing path to the editor with double quotes.
   <string name="ExperiencePermission10">control your camera</string>
   <string name="ExperiencePermission11">teleport you</string>
   <string name="ExperiencePermission12">automatically accept experience permissions</string>
+  <string name="ExperiencePermission16">force your avatar to sit</string>
+  <string name="ExperiencePermission17">change your environment settings</string>
   <string name="ExperiencePermissionShortUnknown">perform an unknown operation: [Permission]</string>
   <string name="ExperiencePermissionShort1">Take Controls</string>
   <string name="ExperiencePermissionShort3">Trigger Animations</string>
@@ -4227,6 +4229,8 @@ Try enclosing path to the editor with double quotes.
   <string name="ExperiencePermissionShort10">Control Camera</string>
   <string name="ExperiencePermissionShort11">Teleport</string>
   <string name="ExperiencePermissionShort12">Permission</string>
+  <string name="ExperiencePermissionShort16">Sit</string>
+  <string name="ExperiencePermissionShort17">Environment</string>
 
   <!-- Conversation log messages -->
   <string name="logging_calls_disabled_log_empty">