summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/settings.xml15
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl17
-rw-r--r--indra/newview/pipeline.cpp12
-rw-r--r--indra/newview/pipeline.h3
4 files changed, 38 insertions, 9 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index f27444ca27..c90c9c543c 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -9195,7 +9195,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <integer>40</integer>
+ <integer>25</integer>
</map>
<key>RenderScreenSpaceReflectionRayStep</key>
<map>
@@ -9230,6 +9230,17 @@
<key>Value</key>
<real>0.001</real>
</map>
+ <key>RenderScreenSpaceReflectionAdaptiveStepMultiplier</key>
+ <map>
+ <key>Comment</key>
+ <string>Multiplier to scale adaptive stepping.</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <real>1.6</real>
+ </map>
<key>RenderScreenSpaceReflectionGlossySamples</key>
<map>
<key>Comment</key>
@@ -9239,7 +9250,7 @@
<key>Type</key>
<string>S32</string>
<key>Value</key>
- <integer>8</integer>
+ <integer>4</integer>
</map>
<key>RenderBumpmapMinDistanceSquared</key>
<map>
diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
index 5ad25c325f..d291196059 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl
@@ -61,6 +61,8 @@ uniform float rayStep;
uniform float distanceBias;
uniform float depthRejectBias;
uniform float glossySampleCount;
+uniform float adaptiveStepMultiplier;
+uniform float noiseSine;
float epsilon = 0.1;
@@ -135,7 +137,7 @@ bool traceScreenRay(vec3 position, vec3 reflection, out vec4 hitColor, out float
if (isExponentialStepEnabled)
{
- step *= 1.05;
+ step *= adaptiveStepMultiplier;
}
}
if(isBinarySearchEnabled)
@@ -302,6 +304,10 @@ uniform vec3 POISSON3D_SAMPLES[128] = vec3[128](
vec3(0.2698198, 0.0002266169, 0.3449324)
);
+vec3 getPoissonSample(int i) {
+ return POISSON3D_SAMPLES[i] * 2 - 1;
+}
+
float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n, inout vec4 collectedColor, sampler2D source, float glossiness)
{
collectedColor = vec4(0);
@@ -319,7 +325,7 @@ float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n,
float vignette = clamp((abs(screenpos.x) * abs(screenpos.y)) * 64,0, 1);
vignette *= clamp((dot(normalize(viewPos), n) * 0.5 + 0.5) * 16, 0, 1);
- float zFar = 32.0;
+ float zFar = 128.0;
vignette *= clamp(1.0+(viewPos.z/zFar), 0.0, 1.0);
@@ -329,17 +335,16 @@ float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n,
totalSamples = int(max(glossySampleCount, glossySampleCount * glossiness * vignette));
- totalSamples = max(totalSamples, 4);
+ totalSamples = max(totalSamples, 1);
{
{
for (int i = 0; i < totalSamples; i++)
{
- vec3 firstBasis = normalize(cross(POISSON3D_SAMPLES[i] * 2 - 1, rayDirection));
+ vec3 firstBasis = normalize(cross(getPoissonSample(i), rayDirection));
vec3 secondBasis = normalize(cross(rayDirection, firstBasis));
vec2 coeffs = vec2(random(tc + vec2(0, i)) + random(tc + vec2(i, 0)));
- vec3 reflectionDirectionRandomized = rayDirection + ((firstBasis * coeffs.x + secondBasis * coeffs.y) * 0.125 * max(glossiness, 0.025));
- //vec3 reflectionDirectionRandomized = rayDirection + (POISSON3D_SAMPLES[i] * 2 - 1) * 0.125 * max(glossiness, 0.025);
+ vec3 reflectionDirectionRandomized = rayDirection + ((firstBasis * coeffs.x + secondBasis * coeffs.y) * glossiness);
//float hitDepth;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index a41bed9186..147d87e0a4 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -195,6 +195,7 @@ S32 LLPipeline::RenderScreenSpaceReflectionIterations;
F32 LLPipeline::RenderScreenSpaceReflectionRayStep;
F32 LLPipeline::RenderScreenSpaceReflectionDistanceBias;
F32 LLPipeline::RenderScreenSpaceReflectionDepthRejectBias;
+F32 LLPipeline::RenderScreenSpaceReflectionAdaptiveStepMultiplier;
S32 LLPipeline::RenderScreenSpaceReflectionGlossySamples;
S32 LLPipeline::RenderBufferVisualization;
LLTrace::EventStatHandle<S64> LLPipeline::sStatBatchSize("renderbatchsize");
@@ -552,7 +553,8 @@ void LLPipeline::init()
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionRayStep");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionDistanceBias");
connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionDepthRejectBias");
- connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionsGlossySamples");
+ connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionAdaptiveStepMultiplier");
+ connectRefreshCachedSettingsSafe("RenderScreenSpaceReflectionGlossySamples");
connectRefreshCachedSettingsSafe("RenderBufferVisualization");
gSavedSettings.getControl("RenderAutoHideSurfaceAreaLimit")->getCommitSignal()->connect(boost::bind(&LLPipeline::refreshCachedSettings));
}
@@ -1039,6 +1041,7 @@ void LLPipeline::refreshCachedSettings()
RenderScreenSpaceReflectionRayStep = gSavedSettings.getF32("RenderScreenSpaceReflectionRayStep");
RenderScreenSpaceReflectionDistanceBias = gSavedSettings.getF32("RenderScreenSpaceReflectionDistanceBias");
RenderScreenSpaceReflectionDepthRejectBias = gSavedSettings.getF32("RenderScreenSpaceReflectionDepthRejectBias");
+ RenderScreenSpaceReflectionAdaptiveStepMultiplier = gSavedSettings.getF32("RenderScreenSpaceReflectionAdaptiveStepMultiplier");
RenderScreenSpaceReflectionGlossySamples = gSavedSettings.getS32("RenderScreenSpaceReflectionGlossySamples");
RenderBufferVisualization = gSavedSettings.getS32("RenderBufferVisualization");
sReflectionProbesEnabled = LLFeatureManager::getInstance()->isFeatureAvailable("RenderReflectionsEnabled") && gSavedSettings.getBOOL("RenderReflectionsEnabled");
@@ -8436,6 +8439,13 @@ void LLPipeline::bindReflectionProbes(LLGLSLShader& shader)
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_RAY_STEP, RenderScreenSpaceReflectionRayStep);
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_GLOSSY_SAMPLES, RenderScreenSpaceReflectionGlossySamples);
shader.uniform1f(LLShaderMgr::DEFERRED_SSR_REJECT_BIAS, RenderScreenSpaceReflectionDepthRejectBias);
+ mPoissonOffset++;
+
+ if (mPoissonOffset > 128 - RenderScreenSpaceReflectionGlossySamples)
+ mPoissonOffset = 0;
+
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_NOISE_SINE, mPoissonOffset);
+ shader.uniform1f(LLShaderMgr::DEFERRED_SSR_ADAPTIVE_STEP_MULT, RenderScreenSpaceReflectionAdaptiveStepMultiplier);
channel = shader.enableTexture(LLShaderMgr::SCENE_DEPTH);
if (channel > -1)
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index d9e6cf9933..19c8b06a46 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -630,6 +630,8 @@ public:
S32 mNumVisibleFaces;
+ S32 mPoissonOffset;
+
static S32 sCompiles;
static bool sShowHUDAttachments;
@@ -1034,6 +1036,7 @@ public:
static F32 RenderScreenSpaceReflectionRayStep;
static F32 RenderScreenSpaceReflectionDistanceBias;
static F32 RenderScreenSpaceReflectionDepthRejectBias;
+ static F32 RenderScreenSpaceReflectionAdaptiveStepMultiplier;
static S32 RenderScreenSpaceReflectionGlossySamples;
static S32 RenderBufferVisualization;
};