From 02fb1bd6103cad5538fc170e015f4329f3545542 Mon Sep 17 00:00:00 2001 From: Dave Parks Date: Wed, 18 May 2022 23:51:06 -0500 Subject: Make reflection probe ambiance controllable by a saved setting --- indra/newview/app_settings/settings.xml | 11 +++++++++++ .../app_settings/shaders/class2/deferred/softenLightF.glsl | 7 +++++-- indra/newview/llreflectionmapmanager.cpp | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index aa2f1e9192..874d685ef4 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -10280,6 +10280,17 @@ Value 64 + RenderReflectionProbeAmbiance + + Comment + Amount reflection probes contribute to ambient light. + Persist + 1 + Type + F32 + Value + 0 + RenderReflectionProbeTextureHackID Comment diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index d188233a8d..d6b173b89d 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -69,6 +69,9 @@ layout (std140, binding = 1) uniform ReflectionProbes // number of reflection probes present in refSphere int refmapCount; + + // intensity of ambient light from reflection probes + float reflectionAmbiance; }; uniform float blur_size; @@ -451,7 +454,7 @@ vec3 sampleAmbient(vec3 pos, vec3 dir, float lod) col *= 0.333333; - return col*0.8; // fudge darker + return col*reflectionAmbiance; } @@ -507,7 +510,7 @@ void main() //vec3 amb_vec = env_mat * norm.xyz; - vec3 ambenv = sampleAmbient(pos.xyz, norm.xyz, reflection_lods); + vec3 ambenv = sampleAmbient(pos.xyz, norm.xyz, reflection_lods-1); amblit = max(ambenv, amblit); color.rgb = amblit*ambocc; diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp index f4fdc3993f..8aacbba6be 100644 --- a/indra/newview/llreflectionmapmanager.cpp +++ b/indra/newview/llreflectionmapmanager.cpp @@ -32,6 +32,7 @@ #include "llviewerregion.h" #include "pipeline.h" #include "llviewershadermgr.h" +#include "llviewercontrol.h" extern BOOL gCubeSnapshot; extern BOOL gTeleportDisplay; @@ -514,6 +515,7 @@ void LLReflectionMapManager::setUniforms() GLint refIndex[LL_REFLECTION_PROBE_COUNT][4]; GLint refNeighbor[4096]; GLint refmapCount; + GLfloat reflectionAmbiance; }; mReflectionMaps.resize(LL_REFLECTION_PROBE_COUNT); @@ -521,6 +523,9 @@ void LLReflectionMapManager::setUniforms() ReflectionProbeData rpd; + static LLCachedControl ambiance(gSavedSettings, "RenderReflectionProbeAmbiance", 0.f); + rpd.reflectionAmbiance = ambiance; + // load modelview matrix into matrix 4a LLMatrix4a modelview; modelview.loadu(gGLModelView); -- cgit v1.2.3