From 47e311d6e8b9996de3e0a1ac75c13724ce7735aa Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Fri, 26 May 2023 16:56:33 -0700 Subject: Addressing some performance related feedback with SSR getting drastically slower. DRTVWR-559 DRTVWR-583 --- indra/llrender/llshadermgr.cpp | 1 + indra/llrender/llshadermgr.h | 1 + indra/newview/app_settings/settings.xml | 15 +++++++++++++-- .../shaders/class3/deferred/screenSpaceReflUtil.glsl | 17 +++++++++++------ indra/newview/pipeline.cpp | 12 +++++++++++- indra/newview/pipeline.h | 3 +++ 6 files changed, 40 insertions(+), 9 deletions(-) (limited to 'indra') 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 @@ Type S32 Value - 40 + 25 RenderScreenSpaceReflectionRayStep @@ -9208,6 +9208,17 @@ Value 0.001 + RenderScreenSpaceReflectionAdaptiveStepMultiplier + + Comment + Multiplier to scale adaptive stepping. + Persist + 1 + Type + F32 + Value + 1.6 + RenderScreenSpaceReflectionGlossySamples Comment @@ -9217,7 +9228,7 @@ Type S32 Value - 8 + 4 RenderBumpmapMinDistanceSquared 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 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; }; -- cgit v1.2.3 From 3581c81328f4a34f62ca867f3052115ef590a6b6 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Wed, 14 Jun 2023 05:35:34 -0700 Subject: More performance addressing. Ditch glossy SSR on semi-transparent surfaces. SL-19784 --- .../shaders/class2/deferred/alphaF.glsl | 4 +-- .../shaders/class2/deferred/pbralphaF.glsl | 4 +-- .../shaders/class2/deferred/reflectionProbeF.glsl | 6 ++-- .../shaders/class3/deferred/fullbrightShinyF.glsl | 4 +-- .../shaders/class3/deferred/materialF.glsl | 4 +-- .../shaders/class3/deferred/reflectionProbeF.glsl | 34 +++++++++++++++++----- .../class3/deferred/screenSpaceReflUtil.glsl | 4 +++ .../shaders/class3/deferred/softenLightF.glsl | 8 ++--- 8 files changed, 46 insertions(+), 22 deletions(-) (limited to 'indra') 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..719319004d 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, true); } 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 5fb5647d35..815069bb6a 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..6a3a80a779 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, true); // 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 d291196059..1b822d6a21 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl @@ -310,6 +310,10 @@ vec3 getPoissonSample(int i) { 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; 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); -- cgit v1.2.3 From 22f83b3436129e3198fcdd24ccb30baf253955c7 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Thu, 15 Jun 2023 09:01:39 -0700 Subject: Add missing variable initialization, and make water support glossy SSR again. SL-19784 --- .../newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl | 2 +- .../newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl | 2 +- indra/newview/pipeline.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl index 719319004d..aa6f5a3b62 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/reflectionProbeF.glsl @@ -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, true); + sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness, false); } vec4 sampleReflectionProbesDebug(vec3 pos) diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index 6a3a80a779..1b2a34ef01 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -722,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, true); + doProbeSample(ambenv, glossenv, tc, pos, norm, glossiness, false); // fudge factor to get PBR water at a similar luminance ot legacy water glossenv *= 0.4; diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 147d87e0a4..6847a679f1 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -335,6 +335,7 @@ LLPipeline::LLPipeline() : mTextureMatrixOps(0), mNumVisibleNodes(0), mNumVisibleFaces(0), + mPoissonOffset(0), mInitialized(false), mShadersLoaded(false), -- cgit v1.2.3 From 5dedf6d75389772b88c140695ac421699b24fd81 Mon Sep 17 00:00:00 2001 From: "Jonathan \"Geenz\" Goodman" Date: Thu, 15 Jun 2023 09:31:15 -0700 Subject: Skip samples that are in vignette, and glossiness under a value. SL-19784 --- .../class3/deferred/screenSpaceReflUtil.glsl | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'indra') diff --git a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl index 1b822d6a21..b2d1e75d04 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/screenSpaceReflUtil.glsl @@ -332,6 +332,7 @@ collectedColor = vec4(1, 0, 1, 1); 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; @@ -340,8 +341,9 @@ collectedColor = vec4(1, 0, 1, 1); totalSamples = int(max(glossySampleCount, glossySampleCount * glossiness * vignette)); totalSamples = max(totalSamples, 1); - + if (glossiness < 0.35) { + if (vignette > 0) { for (int i = 0; i < totalSamples; i++) { @@ -363,15 +365,15 @@ collectedColor = vec4(1, 0, 1, 1); collectedColor.a += 1; } } - } - - if (hits > 0) - { - collectedColor /= hits; - } - else - { - collectedColor = vec4(0); + + if (hits > 0) + { + collectedColor /= hits; + } + else + { + collectedColor = vec4(0); + } } } float hitAlpha = hits; -- cgit v1.2.3