diff --git a/autobuild.xml b/autobuild.xml
index 7652b95d9638a6deb4a0c928b5b356aa595d4524..d387dfba72088b28ee7b9882d324fb3ee7ea56e0 100644
--- a/autobuild.xml
+++ b/autobuild.xml
@@ -64,16 +64,16 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-	      <string>1df4dcf1581c3a7eae267d100ddd4b3b</string>
+	      <string>b6fa628aafcdd006d17e799825fbeb91</string>
               <key>url</key>
-              <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/100/1371370/libatmosphere-1.0.0-100-windows64-133713370.tar.bz2</string>
+	      <string>http://automated-builds-secondlife-com.s3.amazonaws.com/ct2/13879/86217/libatmosphere-1.0.0.100-windows64-512753.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows64</string>
           </map>
         </map>
         <key>version</key>
-        <string>1.4.5.504800</string>
+        <string>1.0.0.512753</string>
       </map>
       <key>apr_suite</key>
       <map>
@@ -1724,9 +1724,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>1463e6a7c6aa65bc65292bd7e48c107e</string>
+              <string>7b769c4284bdbd5fce536395d1eab695</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13675/84961/kdu-7.A.3.512635-darwin-512635.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/4054/11304/kdu-7.9.1.504041-darwin-504041.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin</string>
@@ -1736,9 +1736,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>d3ef7a02b7b765355096ba66085433be</string>
+              <string>a48db5cf79a4631090bfc968572d9953</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13674/84957/kdu-7.A.3.512635-darwin64-512635.tar.bz2</string>              
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/4052/11292/kdu-7.9.1.504041-darwin64-504041.tar.bz2</string>
             </map>
             <key>name</key>
             <string>darwin64</string>
@@ -1748,9 +1748,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>78c94809fe2c4ce9323cb2d4a0d1b105</string>
+              <string>ed952c0cb86329e63a8db190953962d8</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13672/84968/kdu-7.A.3.512635-linux-512635.tar.bz2</string>              
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/hg/repo/kdu_3p-update-kdu/rev/296932/arch/Linux/installer/kdu-7.2.296932-linux-296932.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux</string>
@@ -1760,9 +1760,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>87f9381c1da1148985a9f5ef3e09aeba</string>
+              <string>99b0b22f87cebdd02c4cc954a7b3b465</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13673/84974/kdu-7.A.3.512635-linux64-512635.tar.bz2</string>              
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/4053/11298/kdu-7.9.1.504041-linux64-504041.tar.bz2</string>
             </map>
             <key>name</key>
             <string>linux64</string>
@@ -1772,9 +1772,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>e570aaf7e77dec7538f68d1bcfbc5abe</string>
+              <string>f3ff5982b3b5f02738044432dd77a2c1</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13677/84986/kdu-7.A.3.512635-windows-512635.tar.bz2</string>
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/4055/11310/kdu-7.9.1.504041-windows-504041.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows</string>
@@ -1784,9 +1784,9 @@
             <key>archive</key>
             <map>
               <key>hash</key>
-              <string>f8ed3aaf6b3f840a5bf2819e5e931cac</string>
+              <string>3010fa35f412b36296342b07de06f1ca</string>
               <key>url</key>
-              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/13676/84980/kdu-7.A.3.512635-windows64-512635.tar.bz2</string>              
+              <string>http://s3-proxy.lindenlab.com/private-builds-secondlife-com/ct2/4056/11316/kdu-7.9.1.504041-windows64-504041.tar.bz2</string>
             </map>
             <key>name</key>
             <string>windows64</string>
diff --git a/indra/cmake/Atmosphere.cmake b/indra/cmake/Atmosphere.cmake
new file mode 100644
index 0000000000000000000000000000000000000000..0975e3df02e0afdfcef117fa7868193f10442a9a
--- /dev/null
+++ b/indra/cmake/Atmosphere.cmake
@@ -0,0 +1,5 @@
+# -*- cmake -*-
+include(Prebuilt)
+use_prebuilt_binary(libatmosphere)
+set(LIBATMOSPHERE_LIBRARIES libatmosphere)
+set(LIBATMOSPHERE_INCLUDE_DIR ${LIBS_PREBUILT_DIR}/include/atmosphere)
diff --git a/indra/llinventory/llsettingsbase.cpp b/indra/llinventory/llsettingsbase.cpp
index 7ade3451682187cc56367dc7c7085d3c6fe377be..0918252fa0136bafad25773339a35a202ef641e7 100644
--- a/indra/llinventory/llsettingsbase.cpp
+++ b/indra/llinventory/llsettingsbase.cpp
@@ -333,7 +333,7 @@ LLSD LLSettingsBase::settingValidation(LLSD &settings, validation_list_t &valida
         {
             std::stringstream errtext;
 
-            errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!";
+            errtext << "Settings LLSD fails validation and could not be corrected for '" << test.getName() << "'!\n";
             errors.append( errtext.str() );
             isValid = false;
         }
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 420bcb99432c2bd8425ab6bf86ad6bbe79e89fcd..4273e1d3a0a33942d2f3e1a3df5161e5681b2c78 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -191,6 +191,7 @@ class LLSettingsBase :
     typedef std::vector<Validator> validation_list_t;
 
     static LLSD settingValidation(LLSD &settings, validation_list_t &validations);
+
 protected:
 
     LLSettingsBase();
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 572b5703b345ccddd51f70f01c8c43f74c6c06a9..ff3f5224dd70e42da916c436aacc33b8e578ee31 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -79,12 +79,28 @@ const std::string LLSettingsSky::SETTING_MOON_TEXTUREID("moon_id");
 const std::string LLSettingsSky::SETTING_STAR_BRIGHTNESS("star_brightness");
 const std::string LLSettingsSky::SETTING_SUNLIGHT_COLOR("sunlight_color");
 const std::string LLSettingsSky::SETTING_SUN_ROTATION("sun_rotation");
-const std::string LLSettingsSky::SETTING_SUN_TEXUTUREID("sun_id");
+const std::string LLSettingsSky::SETTING_SUN_TEXTUREID("sun_id");
 
 const std::string LLSettingsSky::SETTING_LEGACY_EAST_ANGLE("east_angle");
 const std::string LLSettingsSky::SETTING_LEGACY_ENABLE_CLOUD_SCROLL("enable_cloud_scroll");
 const std::string LLSettingsSky::SETTING_LEGACY_SUN_ANGLE("sun_angle");
 
+// these are new settings for the advanced atmospherics model
+const std::string LLSettingsSky::SETTING_PLANET_RADIUS("planet_radius");
+const std::string LLSettingsSky::SETTING_SKY_BOTTOM_RADIUS("sky_bottom_radius");
+const std::string LLSettingsSky::SETTING_SKY_TOP_RADIUS("sky_top_radius");
+const std::string LLSettingsSky::SETTING_RAYLEIGH_CONFIG("rayleigh");
+const std::string LLSettingsSky::SETTING_MIE_CONFIG("mie");
+const std::string LLSettingsSky::SETTING_ABSORPTION_CONFIG("absorption");
+const std::string LLSettingsSky::KEY_DENSITY_PROFILE("density");
+const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_WIDTH("width");
+const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_TERM("exp_term");
+const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR("exp_scale");
+const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_LINEAR_TERM("linear_term");
+const std::string LLSettingsSky::SETTING_DENSITY_PROFILE_CONSTANT_TERM("constant_term");
+const std::string LLSettingsSky::SETTING_MIE_ANISOTROPY_FACTOR("anisotropy");
+const std::string LLSettingsSky::SETTING_SUN_ARC_RADIANS("sun_arc_radians");
+
 //=========================================================================
 LLSettingsSky::LLSettingsSky(const LLSD &data) :
     LLSettingsBase(data)
@@ -144,6 +160,78 @@ LLSettingsSky::stringset_t LLSettingsSky::getSlerpKeys() const
     return slepSet;
 }
 
+LLSettingsSky::validation_list_t LLSettingsSky::rayleighValidationList()
+{
+    static validation_list_t rayleighValidation;
+    if (rayleighValidation.empty())
+    {
+        rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH,      true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f)))));
+
+        rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM,   true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+        
+        rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f)))));
+
+        rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+
+        rayleighValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+    }
+    return rayleighValidation;
+}
+
+LLSettingsSky::validation_list_t LLSettingsSky::absorptionValidationList()
+{
+    static validation_list_t absorptionValidation;
+    if (absorptionValidation.empty())
+    {
+        absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH,      true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f)))));
+
+        absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM,   true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+        
+        absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f)))));
+
+        absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+
+        absorptionValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+    }
+    return absorptionValidation;
+}
+
+LLSettingsSky::validation_list_t LLSettingsSky::mieValidationList()
+{
+    static validation_list_t mieValidation;
+    if (mieValidation.empty())
+    {
+        mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_WIDTH,      true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(32768.0f)))));
+
+        mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_TERM,   true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+        
+        mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(-1.0f)(1.0f)))));
+
+        mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_LINEAR_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(2.0f)))));
+
+        mieValidation.push_back(Validator(SETTING_DENSITY_PROFILE_CONSTANT_TERM, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+
+        mieValidation.push_back(Validator(SETTING_MIE_ANISOTROPY_FACTOR, true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(1.0f)))));
+    }
+    return mieValidation;
+}
+
 LLSettingsSky::validation_list_t LLSettingsSky::getValidationList() const
 {
     return LLSettingsSky::validationList();
@@ -224,7 +312,19 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
                 LLSD(LLSDArray(0.0f)(0.0f)(0.0f)("*")),
                 LLSD(LLSDArray(3.0f)(3.0f)(3.0f)("*")))));
         validation.push_back(Validator(SETTING_SUN_ROTATION,        true,  LLSD::TypeArray, &Validator::verifyQuaternionNormal));
-        validation.push_back(Validator(SETTING_SUN_TEXUTUREID,      false, LLSD::TypeUUID));
+        validation.push_back(Validator(SETTING_SUN_TEXTUREID,      false, LLSD::TypeUUID));
+
+        validation.push_back(Validator(SETTING_PLANET_RADIUS,       true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f)))));
+
+        validation.push_back(Validator(SETTING_SKY_BOTTOM_RADIUS,   true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f)))));
+
+        validation.push_back(Validator(SETTING_SKY_TOP_RADIUS,       true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(1000.0f)(32768.0f)))));
+
+        validation.push_back(Validator(SETTING_SUN_ARC_RADIANS,      true,  LLSD::TypeReal,  
+            boost::bind(&Validator::verifyFloatRange, _1, LLSD(LLSDArray(0.0f)(0.1f)))));
     }
 
     return validation;
@@ -268,13 +368,194 @@ LLSD LLSettingsSky::defaults()
     dfltsetting[SETTING_BLOOM_TEXTUREID]    = IMG_BLOOM1;
     dfltsetting[SETTING_CLOUD_TEXTUREID]    = LLUUID::null;
     dfltsetting[SETTING_MOON_TEXTUREID]     = IMG_MOON; // gMoonTextureID;   // These two are returned by the login... wow!
-    dfltsetting[SETTING_SUN_TEXUTUREID]     = IMG_SUN;  // gSunTextureID;
+    dfltsetting[SETTING_SUN_TEXTUREID]      = IMG_SUN;  // gSunTextureID;
 
     dfltsetting[SETTING_TYPE] = "sky";
 
+    // defaults are for earth...
+    dfltsetting[SETTING_PLANET_RADIUS]      = 6360.0f;
+    dfltsetting[SETTING_SKY_BOTTOM_RADIUS]  = 6360.0f;
+    dfltsetting[SETTING_SKY_TOP_RADIUS]     = 6420.0f;
+    dfltsetting[SETTING_SUN_ARC_RADIANS]    = 0.00935f / 2.0f;
+
+    LLSD dflt_rayleigh;
+    dflt_rayleigh[SETTING_DENSITY_PROFILE_WIDTH]            = 0.0f; // 0 -> the entire atmosphere
+    dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_TERM]         = 1.0f;
+    dflt_rayleigh[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 8000.0f;
+    dflt_rayleigh[SETTING_DENSITY_PROFILE_LINEAR_TERM]      = 0.0f;
+    dflt_rayleigh[SETTING_DENSITY_PROFILE_CONSTANT_TERM]    = 0.0f;
+
+    dfltsetting[SETTING_RAYLEIGH_CONFIG]    = dflt_rayleigh;
+
+    LLSD dflt_mie;
+    dflt_mie[SETTING_DENSITY_PROFILE_WIDTH]            = 0.0f; // 0 -> the entire atmosphere
+    dflt_mie[SETTING_DENSITY_PROFILE_EXP_TERM]         = 1.0f;
+    dflt_mie[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = -1.0f / 1200.0f;
+    dflt_mie[SETTING_DENSITY_PROFILE_LINEAR_TERM]      = 0.0f;
+    dflt_mie[SETTING_DENSITY_PROFILE_CONSTANT_TERM]    = 0.0f;
+    dflt_mie[SETTING_MIE_ANISOTROPY_FACTOR]            = 0.9f;
+
+    dfltsetting[SETTING_MIE_CONFIG] = dflt_mie;
+
+    // absorption (ozone) has two linear ramping zones
+    LLSD dflt_absorption_a;
+    dflt_absorption_a[SETTING_DENSITY_PROFILE_WIDTH]            = 25000.0f; // 0 -> the entire atmosphere
+    dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_TERM]         = 0.0f;
+    dflt_absorption_a[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f;
+    dflt_absorption_a[SETTING_DENSITY_PROFILE_LINEAR_TERM]      = -1.0f / 25000.0f;
+    dflt_absorption_a[SETTING_DENSITY_PROFILE_CONSTANT_TERM]    = -2.0f / 3.0f;
+
+    LLSD dflt_absorption_b;
+    dflt_absorption_b[SETTING_DENSITY_PROFILE_WIDTH]            = 0.0f; // 0 -> remainder of the atmosphere
+    dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_TERM]         = 0.0f;
+    dflt_absorption_b[SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR] = 0.0f;
+    dflt_absorption_b[SETTING_DENSITY_PROFILE_LINEAR_TERM]      = -1.0f / 15000.0f;
+    dflt_absorption_b[SETTING_DENSITY_PROFILE_CONSTANT_TERM]    = 8.0f  / 3.0f;
+
+    LLSD wtf;
+    wtf.append(dflt_absorption_a);
+    wtf.append(dflt_absorption_b);
+
+    dfltsetting[SETTING_ABSORPTION_CONFIG] = wtf;
+
     return dfltsetting;
 }
 
+#pragma optimize("", off)
+
+LLSD LLSettingsSky::settingValidation(LLSD &settingsIn, validation_list_t &validations)
+{
+    // Make a copy we can safely modify
+    LLSD settings = settingsIn;
+
+    validation_list_t& rayleighValidations   = rayleighValidationList();
+    validation_list_t& absorptionValidations = absorptionValidationList();
+    validation_list_t& mieValidations        = mieValidationList();
+
+    bool isValid = true;
+
+    LLSD& rayleighConfigs   = settings[SETTING_RAYLEIGH_CONFIG];
+    LLSD& mieConfigs        = settings[SETTING_MIE_CONFIG];
+    LLSD& absorptionConfigs = settings[SETTING_ABSORPTION_CONFIG];
+
+// this is an attempt to handle a single defined layer (w/o array elem)
+// but also handle an array of density profiles if they are specified thus.
+    if (rayleighConfigs.isArray())
+    {
+        for (LLSD::array_iterator it = rayleighConfigs.beginArray(); it != rayleighConfigs.endArray(); ++it)
+        {
+            LLSD rayleighResults = LLSettingsBase::settingValidation(*it, rayleighValidations);
+            if (!rayleighResults["success"].asBoolean())
+            {
+                LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL;
+                LLSettingsSky::ptr_t();
+                isValid = false;
+            }
+        }
+    }
+    else
+    {
+        LLSD rayleighResults = LLSettingsBase::settingValidation(rayleighConfigs, rayleighValidations);
+        if (!rayleighResults["success"].asBoolean())
+        {
+            LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL;
+            LLSettingsSky::ptr_t();
+            isValid = false;
+        }
+    }
+
+    if (mieConfigs.isArray())
+    {
+        for (LLSD::array_iterator it = mieConfigs.beginArray(); it != mieConfigs.endArray(); ++it)
+        {
+            LLSD mieResults = LLSettingsBase::settingValidation(*it, mieValidations);
+            if (!mieResults["success"].asBoolean())
+            {
+                LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL;
+                LLSettingsSky::ptr_t();
+                isValid = false;
+            }
+        }
+    }
+    else
+    {
+        LLSD mieResults = LLSettingsBase::settingValidation(mieConfigs, mieValidations);
+        if (!mieResults["success"].asBoolean())
+        {
+            LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL;
+            LLSettingsSky::ptr_t();
+            isValid = false;
+        }
+    }
+
+    if (absorptionConfigs.isArray())
+    {
+        for (LLSD::array_iterator it = absorptionConfigs.beginArray(); it != absorptionConfigs.endArray(); ++it)
+        {
+            LLSD absorptionResults = LLSettingsBase::settingValidation(*it, absorptionValidations);
+            if (!absorptionResults["success"].asBoolean())
+            {
+                LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL;
+                LLSettingsSky::ptr_t();
+                isValid = false;
+            }
+        }
+    }
+    else
+    {
+        LLSD absorptionResults = LLSettingsBase::settingValidation(absorptionConfigs, absorptionValidations);
+        if (!absorptionResults["success"].asBoolean())
+        {
+            LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL;
+            LLSettingsSky::ptr_t();
+            isValid = false;
+        }
+    }
+
+#if 0
+    LLSD& rayleigh   = settings[SETTING_RAYLEIGH_CONFIG];
+    LLSD& absorption = settings[SETTING_ABSORPTION_CONFIG];
+    LLSD& mie        = settings[SETTING_MIE_CONFIG];
+    LLSD rayleighResults   = LLSettingsBase::settingValidation(rayleigh, rayleighValidations);
+    LLSD absorptionResults = LLSettingsBase::settingValidation(absorption, absorptionValidations);
+    LLSD mieResults        = LLSettingsBase::settingValidation(mie, mieValidations);
+
+    if (!rayleighResults["success"].asBoolean())
+    {
+        LL_WARNS("SETTINGS") << "Sky Rayleigh Density Profile setting validation failed!\n" << rayleighResults << LL_ENDL;
+        LLSettingsSky::ptr_t();
+        isValid = false;
+    }
+
+    if (!absorptionResults["success"].asBoolean())
+    {
+        LL_WARNS("SETTINGS") << "Sky Absorption Density Profile setting validation failed!\n" << absorptionResults << LL_ENDL;
+        LLSettingsSky::ptr_t();
+        isValid = false;
+    }
+
+    if (!mieResults["success"].asBoolean())
+    {
+        LL_WARNS("SETTINGS") << "Sky Mie Density Profile setting validation failed!\n" << mieResults << LL_ENDL;
+        LLSettingsSky::ptr_t();
+        isValid = false;
+    }
+#endif
+
+    settings.erase(SETTING_RAYLEIGH_CONFIG);
+    settings.erase(SETTING_ABSORPTION_CONFIG);
+    settings.erase(SETTING_MIE_CONFIG);
+
+    if (isValid)
+    {
+        return LLSettingsBase::settingValidation(settings, validations);
+    }
+
+    return LLSDMap("success", LLSD::Boolean(false));
+}
+
+#pragma optimize("", on)
+
 LLSD LLSettingsSky::translateLegacySettings(LLSD legacy)
 {
     LLSD newsettings(defaults());
diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h
index e9ffbdb32c2e74b971c19fed0e6c6f1c2c8d6e40..1d860016fbba790f16658fe6f671beb6841c7d0a 100644
--- a/indra/llinventory/llsettingssky.h
+++ b/indra/llinventory/llsettingssky.h
@@ -60,7 +60,24 @@ class LLSettingsSky: public LLSettingsBase
     static const std::string SETTING_STAR_BRIGHTNESS;
     static const std::string SETTING_SUNLIGHT_COLOR;
     static const std::string SETTING_SUN_ROTATION;
-    static const std::string SETTING_SUN_TEXUTUREID;
+    static const std::string SETTING_SUN_TEXTUREID;
+
+    static const std::string SETTING_PLANET_RADIUS;
+    static const std::string SETTING_SKY_BOTTOM_RADIUS;
+    static const std::string SETTING_SKY_TOP_RADIUS;
+    static const std::string SETTING_SUN_ARC_RADIANS;
+
+    static const std::string SETTING_RAYLEIGH_CONFIG;
+    static const std::string SETTING_MIE_CONFIG;
+    static const std::string SETTING_ABSORPTION_CONFIG;
+
+    static const std::string KEY_DENSITY_PROFILE;
+        static const std::string SETTING_DENSITY_PROFILE_WIDTH;
+        static const std::string SETTING_DENSITY_PROFILE_EXP_TERM;
+        static const std::string SETTING_DENSITY_PROFILE_EXP_SCALE_FACTOR;
+        static const std::string SETTING_DENSITY_PROFILE_LINEAR_TERM;
+        static const std::string SETTING_DENSITY_PROFILE_CONSTANT_TERM;
+        static const std::string SETTING_MIE_ANISOTROPY_FACTOR;
 
     typedef std::shared_ptr<LLSettingsSky> ptr_t;
     typedef std::pair<F32, F32> azimalt_t;
@@ -345,7 +362,7 @@ class LLSettingsSky: public LLSettingsBase
 
     LLUUID getSunTextureId() const
     {
-        return mSettings[SETTING_SUN_TEXUTUREID].asUUID();
+        return mSettings[SETTING_SUN_TEXTUREID].asUUID();
     }
 
     // Internal/calculated settings
@@ -414,6 +431,8 @@ class LLSettingsSky: public LLSettingsBase
 
     static LLSD     translateLegacySettings(LLSD legacy);
 
+    static LLSD settingValidation(LLSD &settings, validation_list_t &validations);
+
 protected:
     static const std::string SETTING_LEGACY_EAST_ANGLE;
     static const std::string SETTING_LEGACY_ENABLE_CLOUD_SCROLL;
@@ -423,9 +442,14 @@ class LLSettingsSky: public LLSettingsBase
 
     virtual stringset_t getSlerpKeys() const;
 
-    virtual void    updateSettings();
+    virtual void    updateSettings();    
 
 private:
+    // validations for structured sections of sky settings data
+    static validation_list_t rayleighValidationList();
+    static validation_list_t absorptionValidationList();
+    static validation_list_t mieValidationList();
+
     static const F32         NIGHTTIME_ELEVATION;
     static const F32         NIGHTTIME_ELEVATION_COS;
 
diff --git a/indra/llrender/CMakeLists.txt b/indra/llrender/CMakeLists.txt
index 89451a072cab4dc662f9e533177e1948545100ec..dcfbd71dec98af2988f86051d3280df3409c5c44 100644
--- a/indra/llrender/CMakeLists.txt
+++ b/indra/llrender/CMakeLists.txt
@@ -107,7 +107,9 @@ if (BUILD_HEADLESS)
     ${LLXML_LIBRARIES}
     ${LLVFS_LIBRARIES}
     ${LLWINDOW_HEADLESS_LIBRARIES}
-    ${OPENGL_HEADLESS_LIBRARIES})
+    ${LIBATMOSPHERE_LIBRARIES}
+    ${OPENGL_HEADLESS_LIBRARIES}
+    )
 
 endif (BUILD_HEADLESS)
 
@@ -130,6 +132,7 @@ target_link_libraries(llrender
     ${LLVFS_LIBRARIES}
     ${LLWINDOW_LIBRARIES}
     ${FREETYPE_LIBRARIES}
+	${LIBATMOSPHERE_LIBRARIES}
     ${OPENGL_LIBRARIES}
-    ${ATMOSPHERE_LIBRARIES})
+    )
 
diff --git a/indra/llrender/llatmosphere.cpp b/indra/llrender/llatmosphere.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fb159a3e4707682666efa9086e6fdb83e3e8bb44
--- /dev/null
+++ b/indra/llrender/llatmosphere.cpp
@@ -0,0 +1,218 @@
+/** 
+ * @file llatmosphere.cpp
+ * @brief LLAtmosphere integration impl
+ *
+ * $LicenseInfo:firstyear=2018&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2018, 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$
+ */
+
+#include "linden_common.h"
+
+#include "llatmosphere.h"
+#include "llfasttimer.h"
+#include "llsys.h"
+#include "llglheaders.h"
+#include "llrender.h"
+#include "llshadermgr.h"
+#include "llglslshader.h"
+
+LLAtmosphere* gAtmosphere = nullptr;
+
+void LLAtmosphere::initClass()
+{
+    if (!gAtmosphere)
+    { 
+        gAtmosphere = new LLAtmosphere; 
+    }
+}
+
+void LLAtmosphere::cleanupClass()
+{
+    if(gAtmosphere)
+    {
+        delete gAtmosphere;
+    }
+    gAtmosphere = NULL;
+}
+
+LLAtmosphere::LLAtmosphere()
+{
+    // Init libatmosphere model
+    m_config.num_scattering_orders = 4;
+
+    // Values from "Reference Solar Spectral Irradiance: ASTM G-173", ETR column
+    // (see http://rredc.nrel.gov/solar/spectra/am1.5/ASTMG173/ASTMG173.html),
+    // summed and averaged in each bin (e.g. the value for 360nm is the average
+    // of the ASTM G-173 values for all wavelengths between 360 and 370nm).
+    // Values in W.m^-2.
+    const int kLambdaMin = 360;
+    const int kLambdaMax = 830;
+    const double kSolarIrradiance[48] = {
+        1.11776, 1.14259, 1.01249, 1.14716, 1.72765, 1.73054, 1.6887, 1.61253,
+        1.91198, 2.03474, 2.02042, 2.02212, 1.93377, 1.95809, 1.91686, 1.8298,
+        1.8685, 1.8931, 1.85149, 1.8504, 1.8341, 1.8345, 1.8147, 1.78158, 1.7533,
+        1.6965, 1.68194, 1.64654, 1.6048, 1.52143, 1.55622, 1.5113, 1.474, 1.4482,
+        1.41018, 1.36775, 1.34188, 1.31429, 1.28303, 1.26758, 1.2367, 1.2082,
+        1.18737, 1.14683, 1.12362, 1.1058, 1.07124, 1.04992
+    };
+
+    // Values from http://www.iup.uni-bremen.de/gruppen/molspec/databases/
+    // referencespectra/o3spectra2011/index.html for 233K, summed and averaged in
+    // each bin (e.g. the value for 360nm is the average of the original values
+    // for all wavelengths between 360 and 370nm). Values in m^2.
+    const double kOzoneCrossSection[48] = {
+        1.18e-27, 2.182e-28, 2.818e-28, 6.636e-28, 1.527e-27, 2.763e-27, 5.52e-27,
+        8.451e-27, 1.582e-26, 2.316e-26, 3.669e-26, 4.924e-26, 7.752e-26, 9.016e-26,
+        1.48e-25, 1.602e-25, 2.139e-25, 2.755e-25, 3.091e-25, 3.5e-25, 4.266e-25,
+        4.672e-25, 4.398e-25, 4.701e-25, 5.019e-25, 4.305e-25, 3.74e-25, 3.215e-25,
+        2.662e-25, 2.238e-25, 1.852e-25, 1.473e-25, 1.209e-25, 9.423e-26, 7.455e-26,
+        6.566e-26, 5.105e-26, 4.15e-26, 4.228e-26, 3.237e-26, 2.451e-26, 2.801e-26,
+        2.534e-26, 1.624e-26, 1.465e-26, 2.078e-26, 1.383e-26, 7.105e-27
+    };
+
+    // From https://en.wikipedia.org/wiki/Dobson_unit, in molecules.m^-2.
+    const double kDobsonUnit = 2.687e20;
+
+    // Maximum number density of ozone molecules, in m^-3 (computed so at to get
+    // 300 Dobson units of ozone - for this we divide 300 DU by the integral of
+    // the ozone density profile defined below, which is equal to 15km).
+    const double kMaxOzoneNumberDensity = 300.0 * kDobsonUnit / 15000.0;
+ 
+    const double kSunAngularRadius = 0.00935 / 2.0;
+    const double kBottomRadius = 6360000.0;
+    const double kTopRadius = 6420000.0;
+    const double kRayleigh = 1.24062e-6;
+    const double kRayleighScaleHeight = 8000.0;
+    const double kMieScaleHeight = 1200.0;
+    const double kMieAngstromAlpha = 0.0;
+    const double kMieAngstromBeta = 5.328e-3;
+    const double kMieSingleScatteringAlbedo = 0.9;
+    const double kMiePhaseFunctionG = 0.8;
+    const double max_sun_zenith_angle = F_PI * 2.0 / 3.0;
+
+    atmosphere::DensityProfileLayer rayleigh_density(0.0, 1.0, -1.0 / kRayleighScaleHeight, 0.0, 0.0);
+    atmosphere::DensityProfileLayer mie_density(0.0, 1.0, -1.0 / kMieScaleHeight, 0.0, 0.0);
+
+    // Density profile increasing linearly from 0 to 1 between 10 and 25km, and
+    // decreasing linearly from 1 to 0 between 25 and 40km. This is an approximate
+    // profile from http://www.kln.ac.lk/science/Chemistry/Teaching_Resources/
+    // Documents/Introduction%20to%20atmospheric%20chemistry.pdf (page 10).
+    std::vector<atmosphere::DensityProfileLayer> ozone_density;
+    ozone_density.push_back(atmosphere::DensityProfileLayer(25000.0, 0.0, 0.0, 1.0 / 15000.0, -2.0 / 3.0));
+    ozone_density.push_back(atmosphere::DensityProfileLayer(0.0, 0.0, 0.0, -1.0 / 15000.0, 8.0 / 3.0));
+
+    std::vector<double> wavelengths;
+    std::vector<double> solar_irradiance;
+    std::vector<double> rayleigh_scattering;
+    std::vector<double> mie_scattering;
+    std::vector<double> mie_extinction;
+    std::vector<double> absorption_extinction;
+    std::vector<double> ground_albedo;
+
+    for (int l = kLambdaMin; l <= kLambdaMax; l += 10)
+    {
+        double lambda = static_cast<double>(l) * 1e-3;  // micro-meters
+        double mie    = kMieAngstromBeta / kMieScaleHeight * pow(lambda, -kMieAngstromAlpha);
+        wavelengths.push_back(l);
+        solar_irradiance.push_back(kSolarIrradiance[(l - kLambdaMin) / 10]);
+        rayleigh_scattering.push_back(kRayleigh * pow(lambda, -4));
+        mie_scattering.push_back(mie * kMieSingleScatteringAlbedo);
+        mie_extinction.push_back(mie);
+        absorption_extinction.push_back(kMaxOzoneNumberDensity * kOzoneCrossSection[(l - kLambdaMin) / 10]);
+        ground_albedo.push_back(0.1f);
+    }
+
+    m_model = new atmosphere::Model(
+                                wavelengths,
+                                solar_irradiance,
+                                kSunAngularRadius,
+                                kBottomRadius,
+                                kTopRadius,
+                                {rayleigh_density},
+                                rayleigh_scattering,
+                                {mie_density},
+                                mie_scattering,
+                                mie_extinction,
+                                kMiePhaseFunctionG,
+                                ozone_density,
+                                absorption_extinction,
+                                ground_albedo,
+                                max_sun_zenith_angle,
+                                1000.0,   
+                                15,
+                                false,
+                                true);
+
+    m_model->Init(m_config, m_textures);
+
+    m_transmittance  = new LLGLTexture;
+    m_scattering     = new LLGLTexture;
+    m_mie_scattering = new LLGLTexture;
+
+    m_transmittance->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
+    m_transmittance->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
+    m_transmittance->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
+    m_transmittance->setTexName(m_textures.transmittance_texture);
+    m_transmittance->setTarget(GL_TEXTURE_2D, LLTexUnit::TT_TEXTURE);
+
+    m_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
+    m_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
+    m_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
+    m_scattering->setTexName(m_textures.transmittance_texture);
+    m_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
+
+    m_mie_scattering->setAddressMode(LLTexUnit::eTextureAddressMode::TAM_CLAMP);
+    m_mie_scattering->setFilteringOption(LLTexUnit::eTextureFilterOptions::TFO_BILINEAR);
+    m_mie_scattering->setExplicitFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
+    m_mie_scattering->setTexName(m_textures.transmittance_texture);
+    m_mie_scattering->setTarget(GL_TEXTURE_3D, LLTexUnit::TT_TEXTURE_3D);
+};
+
+LLAtmosphere::~LLAtmosphere()
+{
+    // Cease referencing textures from atmosphere::model from our LLGLTextures wrappers for same.
+    m_transmittance->setTexName(0);
+    m_scattering->setTexName(0);
+    m_mie_scattering->setTexName(0);
+
+    delete m_model;
+    m_model = nullptr;
+}
+
+LLGLTexture* LLAtmosphere::getTransmittance() const
+{
+    return m_transmittance;
+}
+
+LLGLTexture* LLAtmosphere::getScattering() const
+{
+    return m_scattering;
+}
+
+LLGLTexture* LLAtmosphere::getMieScattering() const
+{
+    return m_mie_scattering;
+}
+
+GLuint LLAtmosphere::getAtmosphericShaderForLink() const
+{
+    return m_model ? m_model->GetShader() : 0;
+}
diff --git a/indra/llrender/llatmosphere.h b/indra/llrender/llatmosphere.h
new file mode 100644
index 0000000000000000000000000000000000000000..4aa36be27f7bba63b4839691725894a0258048d9
--- /dev/null
+++ b/indra/llrender/llatmosphere.h
@@ -0,0 +1,72 @@
+/** 
+ * @file llatmosphere.h
+ * @brief LLAtmosphere class for integration with libatmosphere
+ *
+ * $LicenseInfo:firstyear=2018&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2018, 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$
+ */
+
+#ifndef LL_ATMOSPHERE_H
+#define LL_ATMOSPHERE_H
+
+#include "llglheaders.h"
+#include "llgltexture.h"
+#include "libatmosphere/model.h"
+
+class LLAtmosphere
+{
+public:
+     LLAtmosphere();
+    ~LLAtmosphere();
+
+    static void initClass();
+    static void cleanupClass();
+
+    const LLAtmosphere& operator=(const LLAtmosphere& rhs)
+    {
+        LL_ERRS() << "Illegal operation!" << LL_ENDL;
+        return *this;
+    }
+
+    LLGLTexture* getTransmittance() const;
+    LLGLTexture* getScattering() const;
+    LLGLTexture* getMieScattering() const;
+
+    GLuint getAtmosphericShaderForLink() const;
+
+protected:    
+    LLAtmosphere(const LLAtmosphere& rhs)
+    {
+        *this = rhs;
+    }
+
+    atmosphere::ModelConfig         m_config;    
+    atmosphere::PrecomputedTextures m_textures;
+    atmosphere::Model*              m_model = nullptr;
+
+    LLPointer<LLGLTexture> m_transmittance;
+    LLPointer<LLGLTexture> m_scattering;
+    LLPointer<LLGLTexture> m_mie_scattering;
+};
+
+extern LLAtmosphere* gAtmosphere;
+
+#endif // LL_ATMOSPHERE_H
diff --git a/indra/llrender/llgltexture.h b/indra/llrender/llgltexture.h
index a57e48ffad14fc0621c7a0aaf155fbf883527e0a..b8d646ed157de501a8e4aa10e947e9f6a3d41165 100644
--- a/indra/llrender/llgltexture.h
+++ b/indra/llrender/llgltexture.h
@@ -133,7 +133,7 @@ class LLGLTexture : public LLTexture
 	void       setGLTextureCreated (bool initialized);
 	void       setCategory(S32 category) ;
     void       setTexName(LLGLuint); // for forcing w/ externally created textures only
-    void setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target);
+    void       setTarget(const LLGLenum target, const LLTexUnit::eTextureType bind_target);
 
 	LLTexUnit::eTextureAddressMode getAddressMode(void) const ;
 	S32        getMaxDiscardLevel() const;
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index d277a1158c0d91fcb887852e874624f1fdf0cd66..9f1b9fb373124d1934a91f81767ab9e3e490a582 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10131,7 +10131,7 @@
     <key>Type</key>
     <string>Boolean</string>
     <key>Value</key>
-    <integer>1</integer>
+    <integer>0</integer>
   </map>
   <key>RenderUseTriStrips</key>
   <map>
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 042d7d971a5fb5cd40c33fb083c43ce82484fc55..a28041034b5de0e9386e862c32aaf011ff552ace 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -186,7 +186,7 @@ void LLDrawPoolWLSky::renderSkyHaze(F32 camHeightLocal) const
             // bind precomputed textures necessary for calculating sun and sky luminance
             sky_shader->bindTexture(LLShaderMgr::TRANSMITTANCE_TEX, gAtmosphere->getTransmittance());
             sky_shader->bindTexture(LLShaderMgr::SCATTER_TEX, gAtmosphere->getScattering());
-            sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getSingleMieScattering());
+            sky_shader->bindTexture(LLShaderMgr::SINGLE_MIE_SCATTER_TEX, gAtmosphere->getMieScattering());
 
             static float sunSize = (float)cos(0.0005);
 
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 6b1c663357c1682c4a0fe04170b02d3620df218e..db68b39f75cd11ff793aff20248476d99b25a0b4 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -117,6 +117,7 @@ LLSettingsSky::ptr_t LLSettingsVOSky::buildDefaultSky()
     settings[SETTING_NAME] = std::string("_default_");
 
     LLSettingsSky::validation_list_t validations = LLSettingsSky::validationList();
+
     LLSD results = LLSettingsSky::settingValidation(settings, validations);
     if (!results["success"].asBoolean())
     {
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index bec05fa26300bbbe5ac129efe18d02682118a780..6d174442fb73c90523573495a200744210c8d62b 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -3308,7 +3308,7 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
     }
 
 	// this shader uses gather so it can't live with the other basic shaders safely
-	if (success)
+	if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] >= 3))
 	{
 		gDownsampleMinMaxDepthRectProgram.mName = "DownsampleMinMaxDepthRect Shader";
 		gDownsampleMinMaxDepthRectProgram.mShaderFiles.clear();
@@ -3331,8 +3331,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
         success = gInscatterRectProgram.createShader(NULL, NULL);
     }
 
-    llassert(success);
-
 	if (success)
 	{
 		gWLSkyProgram.mName = "Windlight Sky Shader";
@@ -3349,8 +3347,6 @@ BOOL LLViewerShaderMgr::loadShadersWindLight()
 		success = gWLSkyProgram.createShader(NULL, NULL);
 	}
 
-    llassert(success);
-
     if (success && (mVertexShaderLevel[SHADER_WINDLIGHT] < 3))
 	{
 		gWLCloudProgram.mName = "Windlight Cloud Program";
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index cbde0af9b3dc22720adc824936c62bbf2294fef2..e59e86529abddc4b350c04b5bc46691ad10a691b 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -98,8 +98,8 @@ const S32 MAX_CACHED_RAW_IMAGE_AREA = 64 * 64;
 const S32 MAX_CACHED_RAW_SCULPT_IMAGE_AREA = LLViewerTexture::sMaxSculptRez * LLViewerTexture::sMaxSculptRez;
 const S32 MAX_CACHED_RAW_TERRAIN_IMAGE_AREA = 128 * 128;
 const S32 DEFAULT_ICON_DIMENTIONS = 32;
-S32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256.
-S32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA;
+U32 LLViewerTexture::sMinLargeImageSize = 65536; //256 * 256.
+U32 LLViewerTexture::sMaxSmallImageSize = MAX_CACHED_RAW_IMAGE_AREA;
 BOOL LLViewerTexture::sFreezeImageScalingDown = FALSE;
 F32 LLViewerTexture::sCurrentTime = 0.0f;
 F32  LLViewerTexture::sTexelPixelRatio = 1.0f;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 849273df1508c1252cece6b4838f24f1c3bf1ca4..8f691a0453eb5fc708a65f4bd3ab1aedb63214aa 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -381,7 +381,7 @@ bool	LLPipeline::sRenderBump = true;
 bool	LLPipeline::sBakeSunlight = false;
 bool	LLPipeline::sNoAlpha = false;
 bool	LLPipeline::sUseTriStrips = true;
-bool	LLPipeline::sUseAdvancedAtmospherics = true;
+bool	LLPipeline::sUseAdvancedAtmospherics = false;
 bool	LLPipeline::sUseFarClip = true;
 bool	LLPipeline::sShadowRender = false;
 bool	LLPipeline::sWaterReflections = false;