summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2011-11-10 16:12:50 -0600
committerDave Parks <davep@lindenlab.com>2011-11-10 16:12:50 -0600
commitdf546bfba965ec9ec43b7611bb25b5b5ec8f01b5 (patch)
tree11f7cdd4fba6fb79877c6ceaa2cc03dd6794f62e /indra/newview
parent76bd8cee1120ac531d56b9897b135e9c1af1bb16 (diff)
SH-2666 Tweak depth of field optimizations based on resident feedback.
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/app_settings/settings.xml14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/cofF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl1
-rw-r--r--indra/newview/pipeline.cpp8
-rw-r--r--indra/newview/pipeline.h1
6 files changed, 40 insertions, 5 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index d07efa6a37..aa08b0783e 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -8017,7 +8017,19 @@
<key>Value</key>
<integer>0</integer>
</map>
-
+
+ <key>CameraDoFResScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Amount to scale down depth of field resolution. Valid range is 0.25 (quarter res) to 1.0 (full res)</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>0.7</real>
+ </map>
+
<key>RenderSpotLightsInNondeferred</key>
<map>
<key>Comment</key>
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
index 56fa4e693b..88fe3c3dee 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/cofF.glsl
@@ -83,5 +83,5 @@ void main()
vec4 bloom = texture2D(bloomMap, vary_fragcoord.xy/screen_res);
gl_FragColor.rgb = diff.rgb + bloom.rgb;
- gl_FragColor.a = sc/10.f;
+ gl_FragColor.a = sc/max_cof;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
index d2903b545c..21453aefaa 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/dofCombineF.glsl
@@ -36,6 +36,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform float max_cof;
+uniform float res_scale;
VARYING vec2 vary_fragcoord;
@@ -43,10 +44,24 @@ void main()
{
vec2 tc = vary_fragcoord.xy;
- vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*0.5);
+ vec4 dof = texture2DRect(diffuseRect, vary_fragcoord.xy*res_scale);
vec4 diff = texture2DRect(lightMap, vary_fragcoord.xy);
- float a = min(diff.a * max_cof*0.333, 1.0);
+ float a = min(diff.a * max_cof*res_scale*res_scale, 1.0);
+
+ if (a > 0.25 && a < 0.75)
+ { //help out the transition a bit
+ float sc = a/res_scale;
+
+ vec4 col;
+ col = texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,sc));
+ col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,sc));
+ col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(sc,-sc));
+ col += texture2DRect(lightMap, vary_fragcoord.xy+vec2(-sc,-sc));
+
+ diff = mix(diff, col*0.25, a);
+ }
+
gl_FragColor = mix(diff, dof, a);
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
index 629648ddc3..4603d99c5e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredF.glsl
@@ -34,6 +34,7 @@ uniform sampler2DRect diffuseRect;
uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform float max_cof;
+uniform float res_scale;
VARYING vec2 vary_fragcoord;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 3f91c3cddc..da4ffd97de 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -186,6 +186,7 @@ F32 LLPipeline::RenderShadowErrorCutoff;
F32 LLPipeline::RenderShadowFOVCutoff;
BOOL LLPipeline::CameraOffset;
F32 LLPipeline::CameraMaxCoF;
+F32 LLPipeline::CameraDoFResScale;
const F32 BACKLIGHT_DAY_MAGNITUDE_AVATAR = 0.2f;
const F32 BACKLIGHT_NIGHT_MAGNITUDE_AVATAR = 0.1f;
@@ -929,6 +930,7 @@ void LLPipeline::refreshCachedSettings()
RenderShadowFOVCutoff = gSavedSettings.getF32("RenderShadowFOVCutoff");
CameraOffset = gSavedSettings.getBOOL("CameraOffset");
CameraMaxCoF = gSavedSettings.getF32("CameraMaxCoF");
+ CameraDoFResScale = gSavedSettings.getF32("CameraDoFResScale");
}
void LLPipeline::releaseGLBuffers()
@@ -6549,6 +6551,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
shader->uniform1f(LLShaderMgr::DOF_TAN_PIXEL_ANGLE, tanf(1.f/LLDrawable::sCurPixelAngle));
shader->uniform1f(LLShaderMgr::DOF_MAGNIFICATION, magnification);
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
@@ -6568,7 +6571,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
{ //perform DoF sampling at half-res (preserve alpha channel)
mScreen.bindTarget();
- glViewport(0,0,mScreen.getWidth()/2, mScreen.getHeight()/2);
+ glViewport(0,0,mScreen.getWidth()*CameraDoFResScale, mScreen.getHeight()*CameraDoFResScale);
gGL.setColorMask(true, false);
shader = &gDeferredPostProgram;
@@ -6580,6 +6583,7 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
}
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
@@ -6611,9 +6615,11 @@ void LLPipeline::renderBloom(BOOL for_snapshot, F32 zoom_factor, int subfield)
if (channel > -1)
{
mScreen.bindTexture(0, channel);
+ gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
}
shader->uniform1f(LLShaderMgr::DOF_MAX_COF, CameraMaxCoF);
+ shader->uniform1f(LLShaderMgr::DOF_RES_SCALE, CameraDoFResScale);
gGL.begin(LLRender::TRIANGLE_STRIP);
gGL.texCoord2f(tc1.mV[0], tc1.mV[1]);
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index e607e0aec6..8b6532ca25 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -846,6 +846,7 @@ public:
static F32 RenderShadowFOVCutoff;
static BOOL CameraOffset;
static F32 CameraMaxCoF;
+ static F32 CameraDoFResScale;
};
void render_bbox(const LLVector3 &min, const LLVector3 &max);