diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
index 4261f943fb8a93c932eadf9e5193c9bd2875c8a2..5addbbb1763ade3c49fd27dfdb8984578dbfb4f6 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaSkinnedV.glsl
@@ -12,7 +12,6 @@ mat4 getObjectSkinnedTransform();
 void calcAtmospherics(vec3 inPositionEye);
 
 float calcDirectionalLight(vec3 n, vec3 l);
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
 
 vec3 atmosAmbient(vec3 light);
 vec3 atmosAffectDirectionalLight(float lightIntensity);
@@ -23,11 +22,36 @@ varying vec3 vary_position;
 varying vec3 vary_ambient;
 varying vec3 vary_directional;
 varying vec3 vary_normal;
-varying vec3 vary_light;
 varying vec3 vary_fragcoord;
+varying vec3 vary_pointlight_col;
 
 uniform float near_clip;
 
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = length(lv);
+	
+	//normalize light vector
+	lv *= 1.0/d;
+	
+	//distance attenuation
+	float dist2 = d*d/(la*la);
+	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
+	// spotlight coefficient.
+	float spot = max(dot(-ln, lv), is_pointlight);
+	da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+	//angular attenuation
+	da *= calcDirectionalLight(n, lv);
+
+	return da;	
+}
+
 void main()
 {
 	gl_TexCoord[0] = gl_MultiTexCoord0;
@@ -53,20 +77,20 @@ void main()
 
 	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
 
-	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-	col.rgb = scaleDownLight(col.rgb);
+	// Collect normal lights
+	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
+	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
+	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
+	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
+	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
+	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
 	
+	vary_pointlight_col = col.rgb*gl_Color.rgb;
+
+	col.rgb = vec3(0,0,0);
+
 	// Add windlight lights
-	col.rgb += atmosAmbient(vec3(0.));
-	
-	vary_light = gl_LightSource[0].position.xyz;
+	col.rgb = atmosAmbient(vec3(0.));
 	
 	vary_ambient = col.rgb*gl_Color.rgb;
 	vary_directional = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index 88ca60318b5fd335622260e716422b0ee48e2491..6dfc1b952c1fc52bb82e8d690228c57d65d13457 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -28,7 +28,6 @@ varying vec3 vary_ambient;
 varying vec3 vary_directional;
 varying vec3 vary_fragcoord;
 varying vec3 vary_position;
-varying vec3 vary_light;
 varying vec3 vary_pointlight_col;
 
 uniform float shadow_bias;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
index 1da3d95069a05746ee90e95588c80ce4674e3ca8..d227346163e052e600adeb27bf51434921bc82fd 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaSkinnedV.glsl
@@ -11,7 +11,6 @@ vec4 calcLighting(vec3 pos, vec3 norm, vec4 color, vec4 baseCol);
 void calcAtmospherics(vec3 inPositionEye);
 
 float calcDirectionalLight(vec3 n, vec3 l);
-float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float is_pointlight);
 mat4 getObjectSkinnedTransform();
 vec3 atmosAmbient(vec3 light);
 vec3 atmosAffectDirectionalLight(float lightIntensity);
@@ -22,12 +21,37 @@ varying vec3 vary_ambient;
 varying vec3 vary_directional;
 varying vec3 vary_fragcoord;
 varying vec3 vary_position;
-varying vec3 vary_light;
+varying vec3 vary_pointlight_col;
 
 uniform float near_clip;
 uniform float shadow_offset;
 uniform float shadow_bias;
 
+float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight)
+{
+	//get light vector
+	vec3 lv = lp.xyz-v;
+	
+	//get distance
+	float d = length(lv);
+	
+	//normalize light vector
+	lv *= 1.0/d;
+	
+	//distance attenuation
+	float dist2 = d*d/(la*la);
+	float da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
+
+	// spotlight coefficient.
+	float spot = max(dot(-ln, lv), is_pointlight);
+	da *= spot*spot; // GL_SPOT_EXPONENT=2
+
+	//angular attenuation
+	da *= calcDirectionalLight(n, lv);
+
+	return da;	
+}
+
 void main()
 {
 	gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
@@ -55,21 +79,21 @@ void main()
 	//vec4 color = calcLighting(pos.xyz, norm, gl_Color, vec4(0.));
 	vec4 col = vec4(0.0, 0.0, 0.0, gl_Color.a);
 
-	// Collect normal lights (need to be divided by two, as we later multiply by 2)
-	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].specular.a);
-	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].specular.a);
-	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].specular.a);
-	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].specular.a);
-	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].specular.a);
-	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].specular.a);
-	col.rgb += gl_LightSource[1].diffuse.rgb*calcDirectionalLight(norm, gl_LightSource[1].position.xyz);
-	col.rgb = scaleDownLight(col.rgb);
+	// Collect normal lights
+	col.rgb += gl_LightSource[2].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[2].position, gl_LightSource[2].spotDirection.xyz, gl_LightSource[2].linearAttenuation, gl_LightSource[2].quadraticAttenuation, gl_LightSource[2].specular.a);
+	col.rgb += gl_LightSource[3].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[3].position, gl_LightSource[3].spotDirection.xyz, gl_LightSource[3].linearAttenuation, gl_LightSource[3].quadraticAttenuation ,gl_LightSource[3].specular.a);
+	col.rgb += gl_LightSource[4].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[4].position, gl_LightSource[4].spotDirection.xyz, gl_LightSource[4].linearAttenuation, gl_LightSource[4].quadraticAttenuation, gl_LightSource[4].specular.a);
+	col.rgb += gl_LightSource[5].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[5].position, gl_LightSource[5].spotDirection.xyz, gl_LightSource[5].linearAttenuation, gl_LightSource[5].quadraticAttenuation, gl_LightSource[5].specular.a);
+	col.rgb += gl_LightSource[6].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[6].position, gl_LightSource[6].spotDirection.xyz, gl_LightSource[6].linearAttenuation, gl_LightSource[6].quadraticAttenuation, gl_LightSource[6].specular.a);
+	col.rgb += gl_LightSource[7].diffuse.rgb*calcPointLightOrSpotLight(pos.xyz, norm, gl_LightSource[7].position, gl_LightSource[7].spotDirection.xyz, gl_LightSource[7].linearAttenuation, gl_LightSource[7].quadraticAttenuation, gl_LightSource[7].specular.a);
 	
+	vary_pointlight_col = col.rgb*gl_Color.rgb;
+
+	col.rgb = vec3(0,0,0);
+
 	// Add windlight lights
-	col.rgb += atmosAmbient(vec3(0.));
-	
-	vary_light = gl_LightSource[0].position.xyz;
-	
+	col.rgb = atmosAmbient(vec3(0.));
+		
 	vary_ambient = col.rgb*gl_Color.rgb;
 	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
 	
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
index ea09d5bb095abcea0b7461fb3ddace91d2b53def..86f014df35f903b93b8eb89b37bcc63cd70f5020 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaV.glsl
@@ -21,7 +21,6 @@ varying vec3 vary_ambient;
 varying vec3 vary_directional;
 varying vec3 vary_fragcoord;
 varying vec3 vary_position;
-varying vec3 vary_light;
 varying vec3 vary_pointlight_col;
 
 uniform float near_clip;
@@ -86,8 +85,6 @@ void main()
 	// Add windlight lights
 	col.rgb = atmosAmbient(vec3(0.));
 	
-	vary_light = gl_LightSource[0].position.xyz;
-	
 	vary_ambient = col.rgb*gl_Color.rgb;
 	vary_directional.rgb = gl_Color.rgb*atmosAffectDirectionalLight(max(calcDirectionalLight(norm, gl_LightSource[0].position.xyz), (1.0-gl_Color.a)*(1.0-gl_Color.a)));
 	
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index e86663b748fb1b7e4313e51c288d1b45da7adecc..058bdcc7308bf9a35709c3304afb724491a06852 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -59,7 +59,6 @@ Disregard96DefaultDrawDistance	1	1
 RenderTextureMemoryMultiple		1	1.0
 SkyUseClassicClouds			1	1
 RenderShaderLightingMaxLevel		1	3
-RenderDeferred				1	0
 RenderDeferred				1	1
 RenderDeferredSSAO			1	1
 RenderShadowDetail			1	2
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index e715054c54e6a02568dbeb1abaf1f0b2750f6961..6bdb1e178724df8fdeb5b7d2628706f962ce4e06 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -62,6 +62,10 @@ Disregard128DefaultDrawDistance	1	1
 Disregard96DefaultDrawDistance	1	1
 SkyUseClassicClouds			1	1
 WatchdogDisabled				1	1
+RenderDeferred				1	1
+RenderDeferredSSAO			1	1
+RenderShadowDetail			1	2
+
 
 //
 // Low Graphics Settings
@@ -91,6 +95,10 @@ VertexShaderEnable			1	0
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
 SkyUseClassicClouds			1	0
+RenderDeferred				1	0
+RenderDeferredSSAO			1	0
+RenderShadowDetail			1	2
+
 
 //
 // Mid Graphics Settings
@@ -118,6 +126,10 @@ RenderWaterReflections		1	0
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	0
 WLSkyDetail					1	48
+RenderDeferred				1	0
+RenderDeferredSSAO			1	0
+RenderShadowDetail			1	2
+
 
 //
 // High Graphics Settings (purty)
@@ -145,6 +157,10 @@ RenderWaterReflections		1	0
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	1
 WLSkyDetail					1	48
+RenderDeferred				1	0
+RenderDeferredSSAO			1	0
+RenderShadowDetail			1	2
+
 
 //
 // Ultra graphics (REALLY PURTY!)
@@ -172,6 +188,10 @@ RenderWaterReflections		1	1
 VertexShaderEnable			1	1
 WindLightUseAtmosShaders	1	1
 WLSkyDetail					1	128
+RenderDeferred				1	0
+RenderDeferredSSAO			1	0
+RenderShadowDetail			1	2
+
 
 //
 // Class Unknown Hardware (unknown)
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index 54689ea808a6ed40e4987394e971b6822edcfc71..6396ca91ffa6521c4fb597ed6c439d6d23ba52a4 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -26,12 +26,6 @@
 
 #include "llviewerprecompiledheaders.h"
 
-#if defined(_DEBUG)
-# if _MSC_VER >= 1400 // Visual C++ 2005 or later
-#	define WINDOWS_CRT_MEM_CHECKS 1
-# endif
-#endif
-
 #include "llappviewerwin32.h"
 
 #include "llmemtype.h"
diff --git a/indra/newview/llfloatermodelpreview.cpp b/indra/newview/llfloatermodelpreview.cpp
index afe57ebb703eec191951b3e23af1c992c26bffb6..e8da1aa42cdde4edfdcbd4b44f1d33d0672ab11f 100644
--- a/indra/newview/llfloatermodelpreview.cpp
+++ b/indra/newview/llfloatermodelpreview.cpp
@@ -112,8 +112,6 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
 const S32 PREF_BUTTON_HEIGHT = 16 + 7 + 16;
 const S32 PREVIEW_TEXTURE_HEIGHT = 300;
 
-const F32 MAXIMUM_PIVOT_OFFSET = 64.0f;
-
 void drawBoxOutline(const LLVector3& pos, const LLVector3& size);
 
 
@@ -1772,8 +1770,6 @@ bool LLModelLoader::doLoadModel()
 
 	processElement(scene);
 	
-	handlePivotPoint( root );
-
 	return true;
 }
 
@@ -1963,49 +1959,6 @@ void LLModelLoader::processJointToNodeMapping( domNode* pNode )
 		}
 	}
 }
-//-----------------------------------------------------------------------------
-// handlePivotPoint()
-//-----------------------------------------------------------------------------
-void LLModelLoader::handlePivotPoint( daeElement* pRoot )
-{
-	//Import an optional pivot point - a pivot point is just a node in the visual scene named "AssetPivot"
-	//If no assetpivot is found then the asset will use the SL default
-	daeElement* pScene = pRoot->getDescendant("visual_scene");
-	if ( pScene )
-	{
-		daeTArray< daeSmartRef<daeElement> > children = pScene->getChildren();
-		S32 childCount = children.getCount();
-		for (S32 i = 0; i < childCount; ++i)
-		{
-			domNode* pNode = daeSafeCast<domNode>(children[i]);
-			if ( pNode && isNodeAPivotPoint( pNode ) )
-			{
-				LLMatrix4 workingTransform;
-				daeSIDResolver nodeResolver( pNode, "./translate" );
-				domTranslate* pTranslate = daeSafeCast<domTranslate>( nodeResolver.getElement() );
-				//Translation via SID was successful
-				//todo#extract via element as well
-				if ( pTranslate )
-				{
-					extractTranslation( pTranslate, workingTransform );
-					LLVector3 pivotTrans = workingTransform.getTranslation();
-					if ( pivotTrans[VX] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VX] < -MAXIMUM_PIVOT_OFFSET || 
-						 pivotTrans[VY] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VY] < -MAXIMUM_PIVOT_OFFSET || 
-						 pivotTrans[VZ] > MAXIMUM_PIVOT_OFFSET || pivotTrans[VZ] < -MAXIMUM_PIVOT_OFFSET ) 
-					{
-						llwarns<<"Asset Pivot Node contains an offset that is too large - values should be within (-"<<MAXIMUM_PIVOT_OFFSET<<","<<MAXIMUM_PIVOT_OFFSET<<")."<<llendl;
-						mPreview->setHasPivot( false );
-					}
-					else
-					{
-						mPreview->setModelPivot( pivotTrans );
-						mPreview->setHasPivot( true );					
-					}
-				}					
-			}
-		}
-	} 
-}
 
 //-----------------------------------------------------------------------------
 // critiqueRigForUploadApplicability()
@@ -2205,27 +2158,7 @@ bool LLModelLoader::isNodeAJoint( domNode* pNode )
 
 	return false;
 }
-//-----------------------------------------------------------------------------
-// isNodeAPivotPoint()
-//-----------------------------------------------------------------------------
-bool LLModelLoader::isNodeAPivotPoint( domNode* pNode )
-{
-	bool result = false;
-	
-	if ( pNode && pNode->getName() )
-	{
-		std::string name = pNode->getName();
-		if ( name == "AssetPivot" )
-		{
-			result = true;
-		}
-		else
-		{
-			result = false;
-		}
-	}	
-	return result;
-}
+
 //-----------------------------------------------------------------------------
 // extractTranslation()
 //-----------------------------------------------------------------------------
@@ -2852,27 +2785,6 @@ void LLFloaterModelPreview::setDetails(F32 x, F32 y, F32 z, F32 streaming_cost,
 	childSetTextArg("physics cost", "[COST]", llformat("%.3f", physics_cost));	
 }
 
-void LLModelPreview::alterModelsPivot( void )
-{
-	for (LLModelLoader::model_list::iterator iter = mBaseModel.begin(); iter != mBaseModel.end(); ++iter)
-	{
-		if ( *iter )
-		{
-			(*iter)->offsetMesh( mModelPivot );
-		}
-	}
-	
-	for ( int i=0;i<LLModel::NUM_LODS;++i )
-	{
-		for (LLModelLoader::model_list::iterator iter = mModel[i].begin(); iter != mModel[i].end(); ++iter)
-		{
-			if ( *iter )
-			{
-				(*iter)->offsetMesh( mModelPivot );
-			}
-		}
-	}
-}
 
 void LLModelPreview::rebuildUploadData()
 {
@@ -3643,21 +3555,19 @@ void LLModelPreview::genLODs(S32 which_lod, U32 decimation, bool enforce_tri_lim
 		glodGroupParameterf(mGroup, GLOD_OBJECT_SPACE_ERROR_THRESHOLD, lod_error_threshold);
 		stop_gloderror();
 
-		glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0);
-		stop_gloderror();
-
-		glodAdaptGroup(mGroup);
-		stop_gloderror();
-
-		if (lod_mode == GLOD_TRIANGLE_BUDGET)
-		{ //SH-632 Always adapt to 0 before adapting to actual desired amount, and always
-			//add 1 to desired amount to avoid decimating below desired amount
+		if (lod_mode != GLOD_TRIANGLE_BUDGET)
+		{ 			
+			glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, 0);
+		}
+		else
+		{
+			//SH-632: always add 1 to desired amount to avoid decimating below desired amount
 			glodGroupParameteri(mGroup, GLOD_MAX_TRIANGLES, triangle_count+1);
-			stop_gloderror();
-
-			glodAdaptGroup(mGroup);
-			stop_gloderror();
 		}
+			
+		stop_gloderror();
+		glodAdaptGroup(mGroup);
+		stop_gloderror();		
 
 		for (U32 mdl_idx = 0; mdl_idx < mBaseModel.size(); ++mdl_idx)
 		{
@@ -4973,11 +4883,6 @@ void LLFloaterModelPreview::onUpload(void* user_data)
 
 	LLFloaterModelPreview* mp = (LLFloaterModelPreview*) user_data;
 
-	if ( mp && mp->mModelPreview->mHasPivot )
-	{
-		mp->mModelPreview->alterModelsPivot();
-	}
-	
 	mp->mModelPreview->rebuildUploadData();
 
 	bool upload_skinweights = mp->childGetValue("upload_skin").asBoolean();
diff --git a/indra/newview/llfloatermodelpreview.h b/indra/newview/llfloatermodelpreview.h
index 92104c01f48c4480315be6d0c4a471953c838294..4d8b46807fbd847116c199b9dd425c2d05a8f6ac 100644
--- a/indra/newview/llfloatermodelpreview.h
+++ b/indra/newview/llfloatermodelpreview.h
@@ -120,9 +120,6 @@ class LLModelLoader : public LLThread
 	void extractTranslation( domTranslate* pTranslate, LLMatrix4& transform );
 	void extractTranslationViaElement( daeElement* pTranslateElement, LLMatrix4& transform );
 	
-	void handlePivotPoint( daeElement* pRoot );
-	bool isNodeAPivotPoint( domNode* pNode );
-	
 	void setLoadState(U32 state);
 
 	void buildJointToNodeMappingFromScene( daeElement* pRoot );
@@ -298,7 +295,6 @@ class LLModelPreview : public LLViewerDynamicTexture, public LLMutex
 	void loadModelCallback(S32 lod);
 	void genLODs(S32 which_lod = -1, U32 decimation = 3, bool enforce_tri_limit = false);
 	void generateNormals();
-	void alterModelsPivot( void );
 	void clearMaterials();
 	U32 calcResourceCost();
 	void rebuildUploadData();
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp
index 54f699e396412d986ce6aa2474cdd3bba4fad6ff..9f302f9e57f2aaa456eb3d3735e8922053a57d81 100755
--- a/indra/newview/llmeshrepository.cpp
+++ b/indra/newview/llmeshrepository.cpp
@@ -1580,27 +1580,7 @@ void LLMeshUploadThread::doIterativeUpload()
 		}
 
 		//queue up models for hull generation
-		LLModel* physics = NULL;
-
-		if (data.mModel[LLModel::LOD_PHYSICS].notNull())
-		{
-			physics = data.mModel[LLModel::LOD_PHYSICS];
-		}
-		else if (data.mModel[LLModel::LOD_MEDIUM].notNull())
-		{
-			physics = data.mModel[LLModel::LOD_MEDIUM];
-		}
-		else
-		{
-			physics = data.mModel[LLModel::LOD_HIGH];
-		}
-
-		if (!physics)
-		{
-			llerrs << "WTF?" << llendl;
-		}
-
-		DecompRequest* request = new DecompRequest(physics, data.mBaseModel, this);
+		DecompRequest* request = new DecompRequest(data.mModel[LLModel::LOD_HIGH], data.mBaseModel, this);
 		gMeshRepo.mDecompThread->submitRequest(request);
 	}
 
diff --git a/indra/newview/llviewercamera.cpp b/indra/newview/llviewercamera.cpp
index 23b0845f318c8c31fd61e9907a90183687c2b85c..7f7366dd3d9ec50b2cf857c28c80e2c05e0938e3 100644
--- a/indra/newview/llviewercamera.cpp
+++ b/indra/newview/llviewercamera.cpp
@@ -756,6 +756,10 @@ LLVector3 LLViewerCamera::roundToPixel(const LLVector3 &pos_agent)
 
 BOOL LLViewerCamera::cameraUnderWater() const
 {
+	if(!gAgent.getRegion())
+	{
+		return FALSE ;
+	}
 	return getOrigin().mV[VZ] < gAgent.getRegion()->getWaterHeight();
 }
 
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index a60d7e0793028f08d373d49a12028ed1fd581ce8..e41773d27365d3d986fcd7bdb7d805b6adc90d37 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -825,7 +825,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//}
 
 		LLPipeline::sUnderWaterRender = LLViewerCamera::getInstance()->cameraUnderWater() ? TRUE : FALSE;
-		LLPipeline::updateRenderDeferred();
+		LLPipeline::refreshRenderDeferred();
 		
 		stop_glerror();
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 923c02b860512193779f7a2317e8697a9a525551..f64eb8986691799addb47364501ca5d81027bad3 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -784,6 +784,21 @@ void LLPipeline::updateRenderDeferred()
 	}
 }
 
+//static
+void LLPipeline::refreshRenderDeferred()
+{
+	if(gPipeline.hasRenderDebugMask(LLPipeline::RENDER_DEBUG_PHYSICS_SHAPES))
+	{
+		//turn the deferred rendering and glow off when draw physics shapes.
+		sRenderDeferred = FALSE ;
+		sRenderGlow = FALSE ;
+	}
+	else
+	{
+		updateRenderDeferred() ;
+	}
+}
+
 void LLPipeline::releaseGLBuffers()
 {
 	assertInitialized();
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 0cf3fde562747685740e5840908fe727b0ce34d5..e9a250cd6d7ba3c7a53d81922e1b25ccd61c7557 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -356,6 +356,7 @@ class LLPipeline
 	static BOOL getRenderHighlights(void* data);
 
 	static void updateRenderDeferred();
+	static void refreshRenderDeferred();
 
 private:
 	void unloadShaders();
diff --git a/indra/newview/skins/default/xui/en/floater_model_wizard.xml b/indra/newview/skins/default/xui/en/floater_model_wizard.xml
index 03af348a8d73e8cfedee346ae17786e00a56dd2c..92d57b20be00a5048bfa1094718c8e259fa10617 100644
--- a/indra/newview/skins/default/xui/en/floater_model_wizard.xml
+++ b/indra/newview/skins/default/xui/en/floater_model_wizard.xml
@@ -449,12 +449,12 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se
 			<slider
 		   follows="left|top"
 		   height="20"
-		   increment="0.5"
+		   increment="1"
 		   layout="topleft"
 		   left="204"
-		   max_val="4"
-		   initial_value="3"
-		   min_val="2"
+		   max_val="3"
+		   initial_value="2"
+		   min_val="0"
 		   name="accuracy_slider"
 		   show_text="false"
 		   top="130"
@@ -464,7 +464,8 @@ Advanced users familiar with 3d content creation tools may prefer to use the [se
 			top_pad="0"  
 			width="300" 
 			left_delta="6" 
-			height="4">'                                             '                                             '</text>
+			height="4">'  
+      </text>
 
 
 			<icon