diff options
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 1 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 1 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 15 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl | 17 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 12 | ||||
| -rw-r--r-- | indra/newview/pipeline.h | 3 | 
6 files changed, 40 insertions, 9 deletions
| diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 01bad3a684..1458b98bf5 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1343,6 +1343,7 @@ void LLShaderMgr::initAttribsAndUniforms()      mReservedUniforms.push_back("depthRejectBias");      mReservedUniforms.push_back("glossySampleCount");      mReservedUniforms.push_back("noiseSine"); +    mReservedUniforms.push_back("adaptiveStepMultiplier");      mReservedUniforms.push_back("modelview_delta");      mReservedUniforms.push_back("inv_modelview_delta"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index 8c19c80cb0..2ab3ba71db 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -168,6 +168,7 @@ public:          DEFERRED_SSR_REJECT_BIAS,           //  "depthRejectBias"          DEFERRED_SSR_GLOSSY_SAMPLES,        //  "glossySampleCount"          DEFERRED_SSR_NOISE_SINE,            //  "noiseSine" +        DEFERRED_SSR_ADAPTIVE_STEP_MULT,    //  "adaptiveStepMultiplier"          MODELVIEW_DELTA_MATRIX,             //  "modelview_delta"          INVERSE_MODELVIEW_DELTA_MATRIX,     //  "inv_modelview_delta" diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0e72fadec7..533a3361e6 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -9173,7 +9173,7 @@      <key>Type</key>      <string>S32</string>      <key>Value</key> -    <integer>40</integer> +    <integer>25</integer>    </map>    <key>RenderScreenSpaceReflectionRayStep</key>    <map> @@ -9208,6 +9208,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> @@ -9217,7 +9228,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 a49c57ba1e..2112993859 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"); @@ -8421,6 +8424,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;  }; | 
