diff --git a/indra/newview/app_settings/shaders/class1/deferred/rlvF.glsl b/indra/newview/app_settings/shaders/class1/deferred/rlvF.glsl
index 0d919476cff55b6b92270af0d50b303d84d1163a..2aa54d746668977bd24207adedbd7afd90ef4cf0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/rlvF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/rlvF.glsl
@@ -22,8 +22,8 @@
 
 VARYING vec2 vary_fragcoord;
 
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect depthMap;
+uniform sampler2D diffuseRect;
+uniform sampler2D depthMap;
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
@@ -43,35 +43,23 @@ uniform vec2 rlvEffectParam5;   // Blur direction (not used for blend)
 #define SPHERE_PARAMS		rlvEffectParam4
 #define BLUR_DIRECTION		rlvEffectParam5.xy
 
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
-	vec2 sc = pos_screen.xy * 2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0, 1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0 * depth - 1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec3 blur13(sampler2DRect source, vec2 tc, vec2 direction)
+vec3 blur13(sampler2D source, vec2 tc, vec2 direction)
 {
   vec4 color = vec4(0.0);
   vec2 off1 = vec2(1.411764705882353) * direction;
   vec2 off2 = vec2(3.2941176470588234) * direction;
   vec2 off3 = vec2(5.176470588235294) * direction;
 
-  color += texture2DRect(source, tc) * 0.1964825501511404;
+  color += texture(source, tc) * 0.1964825501511404;
 
-  color += texture2DRect(source, tc + off1) * 0.2969069646728344;
-  color += texture2DRect(source, tc - off1) * 0.2969069646728344;
+  color += texture(source, tc + off1 / screen_res) * 0.2969069646728344;
+  color += texture(source, tc - off1 / screen_res) * 0.2969069646728344;
 
-  color += texture2DRect(source, tc + off2) * 0.09447039785044732;
-  color += texture2DRect(source, tc - off2) * 0.09447039785044732;
+  color += texture(source, tc + off2 / screen_res) * 0.09447039785044732;
+  color += texture(source, tc - off2 / screen_res) * 0.09447039785044732;
 
-  color += texture2DRect(source, tc + off3) * 0.010381362401148057;
-  color += texture2DRect(source, tc - off3) * 0.010381362401148057;
+  color += texture(source, tc + off3 / screen_res) * 0.010381362401148057;
+  color += texture(source, tc - off3 / screen_res) * 0.010381362401148057;
 
   return color.xyz;
 }
@@ -79,7 +67,7 @@ vec3 blur13(sampler2DRect source, vec2 tc, vec2 direction)
 const float pi = 3.14159265;
 
 // http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
-vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 direction, float strength) {
+vec3 blurVariable(sampler2D source, vec2 tc, float kernelSize, vec2 direction, float strength) {
   float numBlurPixelsPerSide = float(kernelSize / 2);
 
   // Incremental Gaussian Coefficent Calculation (See GPU Gems 3 pp. 877 - 889)
@@ -92,14 +80,14 @@ vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 directio
   float coefficientSum = 0.0;
 
   // Take the central sample first...
-  avgValue += texture2DRect(source, tc) * incrementalGaussian.x;
+  avgValue += texture(source, tc) * incrementalGaussian.x;
   coefficientSum += incrementalGaussian.x;
   incrementalGaussian.xy *= incrementalGaussian.yz;
 
   // Go through the remaining 8 vertical samples (4 on each side of the center)
   for (float i = 1.0; i <= numBlurPixelsPerSide; i++) {
-	avgValue += texture2DRect(source, tc - i * direction) * incrementalGaussian.x;
-	avgValue += texture2DRect(source, tc + i * direction) * incrementalGaussian.x;
+	avgValue += texture(source, tc - i * direction / screen_res) * incrementalGaussian.x;
+	avgValue += texture(source, tc + i * direction / screen_res) * incrementalGaussian.x;
 	coefficientSum += 2.0 * incrementalGaussian.x;
 	incrementalGaussian.xy *= incrementalGaussian.yz;
   }
@@ -107,15 +95,15 @@ vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 directio
   return (avgValue / coefficientSum).rgb;
 }
 
-vec3 chromaticAberration(sampler2DRect source, vec2 tc, vec2 redDrift, vec2 blueDrift, float strength)
+vec3 chromaticAberration(sampler2D source, vec2 tc, vec2 redDrift, vec2 blueDrift, float strength)
 {
-	vec3 sourceColor = texture2DRect(source, tc).rgb;
+	vec3 sourceColor = texture(source, tc).rgb;
 
 	// Sample the color components
 	vec3 driftColor;
-	driftColor.r = texture2DRect(source, tc + redDrift).r;
+	driftColor.r = texture(source, tc + redDrift / screen_res).r;
 	driftColor.g = sourceColor.g;
-	driftColor.b = texture2DRect(source, tc + blueDrift).b;
+	driftColor.b = texture(source, tc + blueDrift / screen_res).b;
 
 	// Adjust the strength of the effect
 	return mix(sourceColor, driftColor, strength);
@@ -123,9 +111,8 @@ vec3 chromaticAberration(sampler2DRect source, vec2 tc, vec2 redDrift, vec2 blue
 
 void main()
 {
-	vec2 fragTC = vary_fragcoord.st;
-	float fragDepth = texture2DRect(depthMap, fragTC).x;
-	vec3 fragPosLocal = getPosition_d(fragTC, fragDepth).xyz;
+	vec2 fragTC = vary_fragcoord.xy;
+	vec3 fragPosLocal = getPositionWithDepth(fragTC, getDepth(fragTC)).xyz;
 	float distance = length(fragPosLocal.xyz - SPHERE_ORIGIN);
 
 	// Linear non-branching interpolation of the strength of the sphere effect (replaces if/elseif/else for x < min, min <= x <= max and x > max)
@@ -133,18 +120,20 @@ void main()
 	effectStrength = mix(effectStrength, mix(0, SPHERE_VALUEMIN, SPHERE_DISTEXTEND.x), distance < SPHERE_DISTMIN);
 	effectStrength = mix(effectStrength, mix(0, SPHERE_VALUEMAX, SPHERE_DISTEXTEND.y), distance > SPHERE_DISTMAX);
 
-	vec3 fragColor;
+
+
+	vec3 fragColor ;
 	switch (rlvEffectMode)
 	{
 		case 0:		// Blend
-			fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+			fragColor = texture(diffuseRect, fragTC).rgb;
 			fragColor = mix(fragColor, SPHERE_PARAMS.rgb, effectStrength);
 			break;
 		case 1:		// Blur (fixed)
-			fragColor = blur13(diffuseRect, fragTC, effectStrength * BLUR_DIRECTION);
+			fragColor = blur13(diffuseRect, fragTC, BLUR_DIRECTION * vec2(effectStrength));
 			break;
 		case 2:		// Blur (variable)
-			fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+			fragColor = texture(diffuseRect, fragTC).rgb;
 			fragColor = mix(fragColor, blurVariable(diffuseRect, fragTC, SPHERE_PARAMS.x, BLUR_DIRECTION, effectStrength), int(effectStrength > 0));
 			break;
 		case 3:		// ChromaticAberration
@@ -152,10 +141,14 @@ void main()
 			break;
 		case 4:		// Pixelate
 			{
-				effectStrength = sign(effectStrength);
-				float pixelWidth = max(1, round(SPHERE_PARAMS.x * effectStrength)); float pixelHeight = max(1, round(SPHERE_PARAMS.y * effectStrength));
-				fragTC = vec2(pixelWidth * floor(fragTC.x / pixelWidth), pixelHeight * floor(fragTC.y / pixelHeight));
-				fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+				if (effectStrength > 0)
+				{
+					effectStrength = sign(effectStrength);
+					vec2 pixelSize = vec2(1.0) / round(SPHERE_PARAMS.xy * vec2(effectStrength)); 
+					fragTC = (floor(fragTC / pixelSize) * pixelSize) + 0.5 / screen_res;
+				}
+
+				fragColor = texture(diffuseRect, fragTC).rgb;
 			}
 			break;
 	}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/rlvFLegacy.glsl b/indra/newview/app_settings/shaders/class1/deferred/rlvFLegacy.glsl
index a945c9b46c5bd27b1dfae189bd05ab8aa38090fb..919fd0be499eb0cd878d05d672b919098e19092e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/rlvFLegacy.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/rlvFLegacy.glsl
@@ -24,8 +24,8 @@
 
 VARYING vec2 vary_fragcoord;
 
-uniform sampler2DRect diffuseRect;
-uniform sampler2DRect depthMap;
+uniform sampler2D diffuseRect;
+uniform sampler2D depthMap;
 uniform mat4 inv_proj;
 uniform vec2 screen_res;
 
@@ -45,35 +45,23 @@ uniform vec2 rlvEffectParam5;   // Blur direction (not used for blend)
 #define SPHERE_PARAMS		rlvEffectParam4
 #define BLUR_DIRECTION		rlvEffectParam5.xy
 
-vec4 getPosition_d(vec2 pos_screen, float depth)
-{
-	vec2 sc = pos_screen.xy * 2.0;
-	sc /= screen_res;
-	sc -= vec2(1.0, 1.0);
-	vec4 ndc = vec4(sc.x, sc.y, 2.0 * depth - 1.0, 1.0);
-	vec4 pos = inv_proj * ndc;
-	pos /= pos.w;
-	pos.w = 1.0;
-	return pos;
-}
-
-vec3 blur13(sampler2DRect source, vec2 tc, vec2 direction)
+vec3 blur13(sampler2D source, vec2 tc, vec2 direction)
 {
   vec4 color = vec4(0.0);
   vec2 off1 = vec2(1.411764705882353) * direction;
   vec2 off2 = vec2(3.2941176470588234) * direction;
   vec2 off3 = vec2(5.176470588235294) * direction;
 
-  color += texture2DRect(source, tc) * 0.1964825501511404;
+  color += texture(source, tc) * 0.1964825501511404;
 
-  color += texture2DRect(source, tc + off1) * 0.2969069646728344;
-  color += texture2DRect(source, tc - off1) * 0.2969069646728344;
+  color += texture(source, tc + off1 / screen_res) * 0.2969069646728344;
+  color += texture(source, tc - off1 / screen_res) * 0.2969069646728344;
 
-  color += texture2DRect(source, tc + off2) * 0.09447039785044732;
-  color += texture2DRect(source, tc - off2) * 0.09447039785044732;
+  color += texture(source, tc + off2 / screen_res) * 0.09447039785044732;
+  color += texture(source, tc - off2 / screen_res) * 0.09447039785044732;
 
-  color += texture2DRect(source, tc + off3) * 0.010381362401148057;
-  color += texture2DRect(source, tc - off3) * 0.010381362401148057;
+  color += texture(source, tc + off3 / screen_res) * 0.010381362401148057;
+  color += texture(source, tc - off3 / screen_res) * 0.010381362401148057;
 
   return color.xyz;
 }
@@ -81,7 +69,7 @@ vec3 blur13(sampler2DRect source, vec2 tc, vec2 direction)
 const float pi = 3.14159265;
 
 // http://callumhay.blogspot.com/2010/09/gaussian-blur-shader-glsl.html
-vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 direction, float strength) {
+vec3 blurVariable(sampler2D source, vec2 tc, float kernelSize, vec2 direction, float strength) {
   float numBlurPixelsPerSide = float(kernelSize / 2);
 
   // Incremental Gaussian Coefficent Calculation (See GPU Gems 3 pp. 877 - 889)
@@ -94,14 +82,14 @@ vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 directio
   float coefficientSum = 0.0;
 
   // Take the central sample first...
-  avgValue += texture2DRect(source, tc) * incrementalGaussian.x;
+  avgValue += texture(source, tc) * incrementalGaussian.x;
   coefficientSum += incrementalGaussian.x;
   incrementalGaussian.xy *= incrementalGaussian.yz;
 
   // Go through the remaining 8 vertical samples (4 on each side of the center)
   for (float i = 1.0; i <= numBlurPixelsPerSide; i++) {
-	avgValue += texture2DRect(source, tc - i * direction) * incrementalGaussian.x;
-	avgValue += texture2DRect(source, tc + i * direction) * incrementalGaussian.x;
+	avgValue += texture(source, tc - i * direction / screen_res) * incrementalGaussian.x;
+	avgValue += texture(source, tc + i * direction / screen_res) * incrementalGaussian.x;
 	coefficientSum += 2.0 * incrementalGaussian.x;
 	incrementalGaussian.xy *= incrementalGaussian.yz;
   }
@@ -109,15 +97,15 @@ vec3 blurVariable(sampler2DRect source, vec2 tc, float kernelSize, vec2 directio
   return (avgValue / coefficientSum).rgb;
 }
 
-vec3 chromaticAberration(sampler2DRect source, vec2 tc, vec2 redDrift, vec2 blueDrift, float strength)
+vec3 chromaticAberration(sampler2D source, vec2 tc, vec2 redDrift, vec2 blueDrift, float strength)
 {
-	vec3 sourceColor = texture2DRect(source, tc).rgb;
+	vec3 sourceColor = texture(source, tc).rgb;
 
 	// Sample the color components
 	vec3 driftColor;
-	driftColor.r = texture2DRect(source, tc + redDrift).r;
+	driftColor.r = texture(source, tc + redDrift / screen_res).r;
 	driftColor.g = sourceColor.g;
-	driftColor.b = texture2DRect(source, tc + blueDrift).b;
+	driftColor.b = texture(source, tc + blueDrift / screen_res).b;
 
 	// Adjust the strength of the effect
 	return mix(sourceColor, driftColor, strength);
@@ -125,9 +113,9 @@ vec3 chromaticAberration(sampler2DRect source, vec2 tc, vec2 redDrift, vec2 blue
 
 void main()
 {
-	vec2 fragTC = vary_fragcoord.st;
-	float fragDepth = texture2DRect(depthMap, fragTC).x;
-	vec3 fragPosLocal = getPosition_d(fragTC, fragDepth).xyz;
+	vec2 fragTC = vary_fragcoord.xy;
+	float fragDepth = texture(depthMap, fragTC).x;
+	vec3 fragPosLocal = getPositionWithDepth(fragTC, getDepth(fragTC)).xyz;
 	float distance = length(fragPosLocal.xyz - SPHERE_ORIGIN);
 
 	// Linear non-branching interpolation of the strength of the sphere effect (replaces if/elseif/else for x < min, min <= x <= max and x > max)
@@ -144,16 +132,16 @@ void main()
 	vec3 fragColor;
 	if (rlvEffectMode == 0)				// Blend
 	{
-		fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+		fragColor = texture(diffuseRect, fragTC).rgb;
 		fragColor = mix(fragColor, SPHERE_PARAMS.rgb, effectStrength);
 	}
 	else if (rlvEffectMode == 1)		// Blur (fixed)
 	{
-		fragColor = blur13(diffuseRect, fragTC, effectStrength * BLUR_DIRECTION);
+		fragColor = blur13(diffuseRect, fragTC, BLUR_DIRECTION * vec2(effectStrength));
 	}
 	else if (rlvEffectMode == 2)		// Blur (variable)
 	{
-		fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+		fragColor = texture(diffuseRect, fragTC).rgb;
 		if (effectStrength > 0)
 		{
 			fragColor = blurVariable(diffuseRect, fragTC, SPHERE_PARAMS.x, BLUR_DIRECTION, effectStrength);
@@ -165,10 +153,14 @@ void main()
 	}
 	else if (rlvEffectMode == 4)		// Pixelate
 	{
-		effectStrength = sign(effectStrength);
-		float pixelWidth = max(1, floor(SPHERE_PARAMS.x * effectStrength)); float pixelHeight = max(1, floor(SPHERE_PARAMS.y * effectStrength));
-		fragTC = vec2(pixelWidth * floor(fragTC.x / pixelWidth), pixelHeight * floor(fragTC.y / pixelHeight));
-		fragColor = texture2DRect(diffuseRect, fragTC).rgb;
+		if (effectStrength > 0)
+		{
+			effectStrength = sign(effectStrength);
+			vec2 pixelSize = vec2(1.0) / round(SPHERE_PARAMS.xy * vec2(effectStrength)); 
+			fragTC = (floor(fragTC / pixelSize) * pixelSize) + 0.5 / screen_res;
+		}
+
+		fragColor = texture(diffuseRect, fragTC).rgb;
 	}
 
 	frag_color.rgb = fragColor;
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index a2445bd6aa6926cedb58f3981379a660aa573d00..132bd24dad7b15c6e121a6383d17bbeabc938858 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -300,9 +300,6 @@ LLViewerShaderMgr::LLViewerShaderMgr() :
     mShaderList.push_back(&gDeferredPBRAlphaProgram);
     mShaderList.push_back(&gHUDPBRAlphaProgram);
     mShaderList.push_back(&gDeferredSkinnedPBRAlphaProgram);
-// [RLVa:KB] - @setsphere
-	mShaderList.push_back(&gRlvSphereProgram);
-// [/RLVa:KB]
 }
 
 LLViewerShaderMgr::~LLViewerShaderMgr()
@@ -589,6 +586,8 @@ void LLViewerShaderMgr::unloadShaders()
 		gDeferredPostColorGradeLUTProgram[i].unload();
 	}
 
+	gRlvSphereProgram.unload();
+
 	mShaderLevel[SHADER_LIGHTING] = 0;
 	mShaderLevel[SHADER_OBJECT] = 0;
 	mShaderLevel[SHADER_AVATAR] = 0;
@@ -1056,6 +1055,8 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 			gDeferredPostColorGradeLUTProgram[i].unload();
 		}
 
+		gRlvSphereProgram.unload();
+
         gHUDPBROpaqueProgram.unload();
         gPBRGlowProgram.unload();
         gDeferredPBROpaqueProgram.unload();
@@ -2930,6 +2931,22 @@ BOOL LLViewerShaderMgr::loadShadersDeferred()
 		}
 	}
 
+// [RLVa:KB] - @setsphere
+	if (success)
+	{
+		gRlvSphereProgram.mName = "RLVa Sphere Post Processing Shader";
+		gRlvSphereProgram.mFeatures.isDeferred = true;
+		gRlvSphereProgram.mShaderFiles.clear();
+		gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvV.glsl", GL_VERTEX_SHADER_ARB));
+ 		if (gGLManager.mGLVersion >= 4.5f)
+			gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvF.glsl", GL_FRAGMENT_SHADER_ARB));
+		else
+			gRlvSphereProgram.mShaderFiles.push_back(make_pair("deferred/rlvFLegacy.glsl", GL_FRAGMENT_SHADER_ARB));
+		gRlvSphereProgram.mShaderLevel = mShaderLevel[SHADER_DEFERRED];
+		success = gRlvSphereProgram.createShader(NULL, NULL);
+	}
+// [/RLV:KB]
+
 	return success;
 }
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 64b136663ee55fc567a88368936de770350fe2ca..1e4f81f237d77982941765b6d5953039a1859450 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -864,6 +864,7 @@ bool LLPipeline::allocateScreenBuffer(U32 resX, U32 resY, U32 samples)
     }
 
     mPostMap.allocate(resX, resY, GL_RGBA);
+	mPostFXMap.allocate(resX, resY, GL_RGBA);
 
     //HACK make screenbuffer allocations start failing after 30 seconds
     if (gSavedSettings.getBOOL("SimulateFBOFailure"))
@@ -1123,6 +1124,7 @@ void LLPipeline::releaseGLBuffers()
     mSceneMap.release();
 
     mPostMap.release();
+	mPostFXMap.release();
 
 	for (U32 i = 0; i < 3; i++)
 	{
@@ -7517,6 +7519,16 @@ void LLPipeline::renderFinalize()
 		mGlow[1].flush();
 	}
 
+// [RLVa:KB] - @setsphere
+	LLRenderTarget* pRenderBuffer = &mPostMap;
+	if (RlvActions::hasBehaviour(RLV_BHVR_SETSPHERE))
+	{
+		LLShaderEffectParams params(pRenderBuffer, &mPostFXMap, false);
+		LLVfxManager::instance().runEffect(EVisualEffect::RlvSphere, &params);
+		pRenderBuffer = params.m_pDstBuffer;
+	}
+// [/RLVa:KB]
+
 	{
         llassert(!gCubeSnapshot);
 		bool multisample = RenderFSAASamples > 1 && mRT->fxaaBuffer.isComplete();
@@ -7559,10 +7571,10 @@ void LLPipeline::renderFinalize()
 			shader->bind();
 			shader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, width, height);
 
-			channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, mPostMap.getUsage());
+			channel = shader->enableTexture(LLShaderMgr::DEFERRED_DIFFUSE, pRenderBuffer->getUsage());
 			if (channel > -1)
 			{
-				mPostMap.bindTexture(0, channel);
+				pRenderBuffer->bindTexture(0, channel);
 			}
 
 			channel = shader->enableTexture(LLShaderMgr::DEFERRED_EMISSIVE, mGlow[1].getUsage());
@@ -7630,7 +7642,7 @@ void LLPipeline::renderFinalize()
 
 			shader->bind();
 
-			shader->bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, &mPostMap);
+			shader->bindTexture(LLShaderMgr::DEFERRED_DIFFUSE, pRenderBuffer);
 			shader->bindTexture(LLShaderMgr::DEFERRED_DEPTH, &mRT->deferredScreen, true);
 			shader->bindTexture(LLShaderMgr::DEFERRED_EMISSIVE, &mGlow[1]);
 
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index 41a681a7b07d081d52c4ef058decfe1063c0a8a2..a57926337b96ca103b1828a785601ab0c5151aef 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -667,6 +667,7 @@ class LLPipeline
 
     // tonemapped and gamma corrected render ready for post
     LLRenderTarget          mPostMap;
+	LLRenderTarget          mPostFXMap;
 
     LLCullResult            mSky;
     LLCullResult            mReflectedObjects;
diff --git a/indra/newview/rlveffects.cpp b/indra/newview/rlveffects.cpp
index f29c587bec5eb8ab591150410873bbb0b7c81ba9..5961df576b08a1a6aea9b23ff66abd9da704167f 100644
--- a/indra/newview/rlveffects.cpp
+++ b/indra/newview/rlveffects.cpp
@@ -298,11 +298,7 @@ ERlvCmdRet RlvSphereEffect::onValueMaxChanged(const LLUUID& idRlvObj, const boos
 
 void RlvSphereEffect::setShaderUniforms(LLGLSLShader* pShader)
 {
-#if 0
-	LLMatrix4a proj = get_current_projection();
-	proj.invert();
-	pShader->uniformMatrix4fv(LLShaderMgr::INVERSE_PROJECTION_MATRIX, 1, FALSE, proj.getF32ptr());
-	pShader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, gPipeline.mScreen.getWidth(), gPipeline.mScreen.getHeight());
+	pShader->uniform2f(LLShaderMgr::DEFERRED_SCREEN_RES, gPipeline.mRT->screen.getWidth(), gPipeline.mRT->screen.getHeight());
 	pShader->uniform1i(LLShaderMgr::RLV_EFFECT_MODE, llclamp((int)m_eMode, 0, (int)ESphereMode::Count));
 
 	// Pass the sphere origin to the shader
@@ -333,12 +329,10 @@ void RlvSphereEffect::setShaderUniforms(LLGLSLShader* pShader)
 
 	// Pass effect params
 	pShader->uniform4fv(LLShaderMgr::RLV_EFFECT_PARAM4, 1, m_Params.get().mV);
-#endif
 }
 
 void RlvSphereEffect::renderPass(LLGLSLShader* pShader, const LLShaderEffectParams* pParams) const
 {
-#if 0
 	if (pParams->m_pDstBuffer)
 	{
 		pParams->m_pDstBuffer->bindTarget();
@@ -357,46 +351,25 @@ void RlvSphereEffect::renderPass(LLGLSLShader* pShader, const LLShaderEffectPara
 	if (nDiffuseChannel > -1)
 	{
 		pParams->m_pSrcBuffer->bindTexture(0, nDiffuseChannel);
-		gGL.getTexUnit(nDiffuseChannel)->setTextureFilteringOption(LLTexUnit::TFO_POINT);
+		gGL.getTexUnit(nDiffuseChannel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
 	}
 
-	S32 nDepthChannel = pShader->enableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mDeferredDepth.getUsage());
+	S32 nDepthChannel = pShader->enableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mRT->deferredScreen.getUsage());
 	if (nDepthChannel > -1)
 	{
-		gGL.getTexUnit(nDepthChannel)->bind(&gPipeline.mDeferredDepth, TRUE);
+		gGL.getTexUnit(nDepthChannel)->bind(&gPipeline.mRT->deferredScreen, TRUE);
 	}
 
-	gGL.matrixMode(LLRender::MM_PROJECTION);
-	gGL.pushMatrix();
-	gGL.loadIdentity();
-	gGL.matrixMode(LLRender::MM_MODELVIEW);
-	gGL.pushMatrix();
-	gGL.loadMatrix(gGLModelView);
-
-	LLVector2 tc1(0, 0);
-	LLVector2 tc2((F32)gPipeline.mScreen.getWidth() * 2, (F32)gPipeline.mScreen.getHeight() * 2);
-	gGL.begin(LLRender::TRIANGLE_STRIP);
-	gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
-	gGL.vertex2f(-1, -1);
-	gGL.texCoord2f(tc1.mV[0], tc2.mV[1]);
-	gGL.vertex2f(-1, 3);
-	gGL.texCoord2f(tc2.mV[0], tc1.mV[1]);
-	gGL.vertex2f(3, -1);
-	gGL.end();
-
-	gGL.matrixMode(LLRender::MM_PROJECTION);
-	gGL.popMatrix();
-	gGL.matrixMode(LLRender::MM_MODELVIEW);
-	gGL.popMatrix();
+	gPipeline.mScreenTriangleVB->setBuffer();
+	gPipeline.mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3);
 
 	pShader->disableTexture(LLShaderMgr::DEFERRED_DIFFUSE, pParams->m_pSrcBuffer->getUsage());
-	pShader->disableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mDeferredDepth.getUsage());
+	pShader->disableTexture(LLShaderMgr::DEFERRED_DEPTH, gPipeline.mRT->deferredScreen.getUsage());
 
 	if (pParams->m_pDstBuffer)
 	{
 		pParams->m_pDstBuffer->flush();
 	}
-#endif
 }
 
 void RlvSphereEffect::run(const LLVisualEffectParams* pParams)
diff --git a/indra/newview/rlvhandler.cpp b/indra/newview/rlvhandler.cpp
index aadb3360543b72b73aabb2d237c7c0e8304a0a9d..3358c68b22b601d481a92f0666f2939cc91e96d6 100644
--- a/indra/newview/rlvhandler.cpp
+++ b/indra/newview/rlvhandler.cpp
@@ -2138,30 +2138,7 @@ ERlvCmdRet RlvBehaviourHandler<RLV_BHVR_SETSPHERE>::onCommand(const RlvCommand&
 	{
 		if (gRlvHandler.hasBehaviour(rlvCmd.getObjectID(), rlvCmd.getBehaviourType()))
 		{
-#if 0
 			LLVfxManager::instance().addEffect(new RlvSphereEffect(rlvCmd.getObjectID()));
-
-			Rlv::forceAtmosphericShadersIfAvailable();
-
-			// If we're not using deferred but are using Windlight shaders we need to force use of FBO and depthmap texture
-			if ( (!LLPipeline::sRenderDeferred) && (LLPipeline::WindLightUseAtmosShaders) && (!LLPipeline::sUseDepthTexture) )
-			{
-				LLRenderTarget::sUseFBO = true;
-				LLPipeline::sUseDepthTexture = true;
-
-				gPipeline.releaseGLBuffers();
-				gPipeline.createGLBuffers();
-				gPipeline.resetVertexBuffers();
-				LLViewerShaderMgr::instance()->setShaders();
-			}
-			else if (!gPipeline.mDeferredLight.isComplete())
-			{
-				// In case of deferred with no shadows, no ambient occlusion, no depth of field, and no antialiasing
-				gPipeline.releaseGLBuffers();
-				gPipeline.createGLBuffers();
-				RLV_ASSERT(gPipeline.mDeferredLight.isComplete());
-			}
-#endif
 		}
 		else
 		{