diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2023-06-15 09:33:20 -0700 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-06-15 09:33:20 -0700 | 
| commit | 44f26248ec668635b5d5b161f4736a670d364792 (patch) | |
| tree | efa26f27eac0b6d1a83a9e25a5396efa7cb0e637 | |
| parent | 3305fbe1cf5fe3faa6dc5479aa29e6c891ee943f (diff) | |
| parent | 07aed1e18646fa788ad79320aaa3e2ff3c7a3f60 (diff) | |
Merge pull request #245 from secondlife/DRTVWR-583-glossy-ssr
Performance and visual tuning of glossy SSR
13 files changed, 99 insertions, 41 deletions
| diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index f398526b41..75d6ef6c46 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -1341,6 +1341,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 5d7ab7c53d..46f352aa58 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -166,6 +166,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 ee14bb2b2f..cb4e5ec7f3 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/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index cd57b47eae..da5f997429 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -85,7 +85,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);  float getAmbientClamp();  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity); +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);  vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)  { @@ -251,7 +251,7 @@ void main()      vec3 irradiance;      vec3 glossenv;      vec3 legacyenv; -    sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0); +    sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true);      float da = dot(norm.xyz, light_dir.xyz); diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index d678973515..e8db856b1f 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -92,7 +92,7 @@ void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float  float calcLegacyDistanceAttenuation(float distance, float falloff);  float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);  void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,  -        vec2 tc, vec3 pos, vec3 norm, float glossiness); +        vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent);  void waterClip(vec3 pos); @@ -224,7 +224,7 @@ void main()      float gloss      = 1.0 - perceptualRoughness;      vec3  irradiance = vec3(0);      vec3  radiance  = vec3(0); -    sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss); +    sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true);      // Take maximium of legacy ambient vs irradiance sample as irradiance      // NOTE: ao is applied in pbrIbl (see pbrBaseLight), do not apply here      irradiance       = max(amblit,irradiance); diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl index 60134a7f72..aa6f5a3b62 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl @@ -34,7 +34,7 @@ uniform mat3 env_mat;  vec3 srgb_to_linear(vec3 c);  void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness) +        vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)  {      ambenv = vec3(reflection_probe_ambiance * 0.25); @@ -46,7 +46,7 @@ void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv,  void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,          vec2 tc, vec3 pos, vec3 norm, float glossiness)  { -    sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness); +    sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false);  }  vec4 sampleReflectionProbesDebug(vec3 pos) @@ -56,7 +56,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos)  }  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity) +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent)  {      ambenv = vec3(reflection_probe_ambiance * 0.25); diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 0d77e88831..1537714bb7 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -49,7 +49,7 @@ vec3 srgb_to_linear(vec3 c);  // reflection probe interface  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity); +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);  void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); @@ -80,7 +80,7 @@ void main()      vec3 legacyenv;      vec3 norm = normalize(vary_texcoord1.xyz);      vec4 spec = vec4(0,0,0,0); -    sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity); +    sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false);      color.rgb = legacy_adjust(color.rgb);      color.rgb = srgb_to_linear(color.rgb); diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index ab40298f44..ac2e359769 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -60,7 +60,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);  #endif  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity); +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);  void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);  void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity); @@ -339,7 +339,7 @@ void main()      vec3 ambenv;      vec3 glossenv;      vec3 legacyenv; -    sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env); +    sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true);      // use sky settings ambient or irradiance map sample, whichever is brighter      color = max(amblit_linear, ambenv); diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 53e15bd1a1..1b2a34ef01 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -35,6 +35,8 @@ uniform sampler2D sceneMap;  uniform int cube_snapshot;  uniform float max_probe_lod; +uniform bool transparent_surface; +  #define MAX_REFMAP_COUNT 256  // must match LL_MAX_REFLECTION_PROBE_COUNT  layout (std140) uniform ReflectionProbes @@ -671,7 +673,7 @@ vec3 sampleProbeAmbient(vec3 pos, vec3 dir)  }  void doProbeSample(inout vec3 ambenv, inout vec3 glossenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness) +        vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)  {      // TODO - don't hard code lods      float reflection_lods = max_probe_lod; @@ -687,7 +689,16 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,      if (cube_snapshot != 1 && glossiness >= 0.9)      {          vec4 ssr = vec4(0); -        float w = tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, glossiness); +        if (transparent) +        { +            tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, 1); +            ssr.a *= glossiness; +        } +        else +        { +            tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, glossiness); +        } +          glossenv = mix(glossenv, ssr.rgb, ssr.a);      } @@ -695,10 +706,10 @@ void doProbeSample(inout vec3 ambenv, inout vec3 glossenv,  }  void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness) +        vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent)  {      preProbeSample(pos); -    doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness); +    doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, transparent);  }  void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, @@ -711,7 +722,7 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv,      // always include void probe on water      probeIndex[probeInfluences++] = 0; -    doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness); +    doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false);      // fudge factor to get PBR water at a similar luminance ot legacy water      glossenv *= 0.4; @@ -766,7 +777,7 @@ vec4 sampleReflectionProbesDebug(vec3 pos)  }  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity) +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent)  {      float reflection_lods = max_probe_lod;      preProbeSample(pos); @@ -790,7 +801,16 @@ void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout      if (cube_snapshot != 1)      {          vec4 ssr = vec4(0); -        float w = tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, glossiness); + +        if (transparent) +        { +            tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, 1); +            ssr.a *= glossiness; +        } +        else +        { +            tapScreenSpaceReflection(1, tc, pos, norm, ssr, sceneMap, glossiness); +        }          glossenv = mix(glossenv, ssr.rgb, ssr.a);          legacyenv = mix(legacyenv, ssr.rgb, ssr.a); diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl index 5ad25c325f..b2d1e75d04 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,8 +304,16 @@ 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)  { +#ifdef TRANSPARENT_SURFACE +collectedColor = vec4(1, 0, 1, 1); +    return 0; +#endif      collectedColor = vec4(0);      int hits = 0; @@ -319,9 +329,10 @@ 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); +    vignette *= clamp(glossiness * 3 - 1.7, 0, 1);      vec4 hitpoint; @@ -329,17 +340,17 @@ 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); +    if (glossiness < 0.35)      { +        if (vignette > 0)          {              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; @@ -354,15 +365,15 @@ float tapScreenSpaceReflection(int totalSamples, vec2 tc, vec3 viewPos, vec3 n,                      collectedColor.a += 1;                  }              } -        } - -        if (hits > 0) -        { -            collectedColor /= hits; -        } -        else -        { -            collectedColor = vec4(0); +             +            if (hits > 0) +            { +                collectedColor /= hits; +            } +            else +            { +                collectedColor = vec4(0); +            }          }      }      float hitAlpha = hits; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 409b46218b..4ef003e0cb 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -69,9 +69,9 @@ vec3  scaleSoftClipFragLinear(vec3 l);  // reflection probe interface  void sampleReflectionProbes(inout vec3 ambenv, inout vec3 glossenv, -    vec2 tc, vec3 pos, vec3 norm, float glossiness); +    vec2 tc, vec3 pos, vec3 norm, float glossiness, bool transparent);  void sampleReflectionProbesLegacy(inout vec3 ambenv, inout vec3 glossenv, inout vec3 legacyenv, -        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity); +        vec2 tc, vec3 pos, vec3 norm, float glossiness, float envIntensity, bool transparent);  void applyGlossEnv(inout vec3 color, vec3 glossenv, vec4 spec, vec3 pos, vec3 norm);  void applyLegacyEnv(inout vec3 color, vec3 legacyenv, vec4 spec, vec3 pos, vec3 norm, float envIntensity);  float getDepth(vec2 pos_screen); @@ -194,7 +194,7 @@ void main()          // PBR IBL          float gloss      = 1.0 - perceptualRoughness; -        sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss); +        sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss, false);          adjustIrradiance(irradiance, amblit_linear, ambocc); @@ -232,7 +232,7 @@ void main()          vec3 glossenv = vec3(0);          vec3 legacyenv = vec3(0); -        sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity); +        sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity, false);          adjustIrradiance(irradiance, amblit_linear, ambocc); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index c88b8b42ff..38f27d4dfa 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"); @@ -334,6 +335,7 @@ LLPipeline::LLPipeline() :  	mTextureMatrixOps(0),  	mNumVisibleNodes(0),  	mNumVisibleFaces(0), +	mPoissonOffset(0),  	mInitialized(false),  	mShadersLoaded(false), @@ -552,7 +554,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 +1042,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 +8440,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;  }; | 
