summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-01-31 15:01:05 -0600
committerDave Parks <davep@lindenlab.com>2023-01-31 15:01:05 -0600
commitc9d56e212aa0117661f9c76545ca84b39412bae7 (patch)
treee57993f680b6260631784c2177b7c0d51ad2b17a
parentc154f4f6da10df693cbe15e0fe291d5b3c423d32 (diff)
SL-19015 Balance sun/sky ambiance with punctual light ambiance. Prevent irradiance maps from being brighter than the environment.
-rw-r--r--indra/llrender/llglslshader.cpp18
-rw-r--r--indra/llrender/llglslshader.h5
-rw-r--r--indra/llrender/llpostprocess.cpp2
-rw-r--r--indra/newview/app_settings/settings.xml11
-rw-r--r--indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl29
-rw-r--r--indra/newview/lldrawpoolbump.cpp2
-rw-r--r--indra/newview/lldrawpoolsimple.cpp2
-rw-r--r--indra/newview/lldynamictexture.cpp2
-rw-r--r--indra/newview/llreflectionmapmanager.cpp49
-rw-r--r--indra/newview/llsettingsvo.cpp64
-rw-r--r--indra/newview/pipeline.cpp45
11 files changed, 124 insertions, 105 deletions
diff --git a/indra/llrender/llglslshader.cpp b/indra/llrender/llglslshader.cpp
index 42b7cc46b3..faa45d59b9 100644
--- a/indra/llrender/llglslshader.cpp
+++ b/indra/llrender/llglslshader.cpp
@@ -1041,26 +1041,10 @@ void LLGLSLShader::bind(bool rigged)
}
}
-void LLGLSLShader::unbind()
+void LLGLSLShader::unbind(void)
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
gGL.flush();
- if (sCurBoundShaderPtr)
- {
- sCurBoundShaderPtr->readProfileQuery();
- }
- stop_glerror();
- LLVertexBuffer::unbind();
- glUseProgram(0);
- sCurBoundShader = 0;
- sCurBoundShaderPtr = NULL;
- stop_glerror();
-}
-
-void LLGLSLShader::bindNoShader(void)
-{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
-
LLVertexBuffer::unbind();
if (sCurBoundShaderPtr)
diff --git a/indra/llrender/llglslshader.h b/indra/llrender/llglslshader.h
index 1ec41ebd3c..6c18282fec 100644
--- a/indra/llrender/llglslshader.h
+++ b/indra/llrender/llglslshader.h
@@ -254,10 +254,9 @@ public:
void bind();
//helper to conditionally bind mRiggedVariant instead of this
void bind(bool rigged);
- void unbind();
-
+
// Unbinds any previously bound shader by explicitly binding no shader.
- static void bindNoShader(void);
+ static void unbind();
U32 mMatHash[LLRender::NUM_MATRIX_MODES];
U32 mLightHash;
diff --git a/indra/llrender/llpostprocess.cpp b/indra/llrender/llpostprocess.cpp
index 0d87800690..f1e5b71207 100644
--- a/indra/llrender/llpostprocess.cpp
+++ b/indra/llrender/llpostprocess.cpp
@@ -376,7 +376,7 @@ void LLPostProcess::doEffects(void)
checkError();
applyShaders();
- LLGLSLShader::bindNoShader();
+ LLGLSLShader::unbind();
checkError();
/// Change to a perspective view
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 41afca50f6..333d764866 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -10393,6 +10393,17 @@
<key>Value</key>
<integer>256</integer>
</map>
+ <key>RenderReflectionProbeAmbianceScale</key>
+ <map>
+ <key>Comment</key>
+ <string>Scaler to apply to reflection probes to over-brighten sky contributions to indirect light</string>
+ <key>Persist</key>
+ <integer>1</integer>
+ <key>Type</key>
+ <string>F32</string>
+ <key>Value</key>
+ <integer>8</integer>
+ </map>
<key>RenderReflectionProbeDrawDistance</key>
<map>
diff --git a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
index a4aec48c59..c7da23fb00 100644
--- a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
@@ -26,20 +26,15 @@
/*[EXTRA_CODE_HERE]*/
-
-#ifdef DEFINE_GL_FRAGCOLOR
out vec4 frag_color;
-#else
-#define frag_color gl_FragColor
-#endif
uniform samplerCubeArray reflectionProbes;
uniform int sourceIdx;
uniform float max_probe_lod;
+uniform float ambiance_scale;
-VARYING vec3 vary_dir;
-
+in vec3 vary_dir;
// Code below is derived from the Khronos GLTF Sample viewer:
// https://github.com/KhronosGroup/glTF-Sample-Viewer/blob/master/source/shaders/ibl_filtering.frag
@@ -48,7 +43,7 @@ VARYING vec3 vary_dir;
#define MATH_PI 3.1415926535897932384626433832795
float u_roughness = 1.0;
-int u_sampleCount = 64;
+int u_sampleCount = 32;
float u_lodBias = 2.0;
int u_width = 64;
@@ -183,8 +178,7 @@ vec4 filterColor(vec3 N)
{
//return textureLod(uCubeMap, N, 3.0).rgb;
vec4 color = vec4(0.f);
- float weight = 0.0f;
-
+
for(int i = 0; i < u_sampleCount; ++i)
{
vec4 importanceSample = getImportanceSample(i, N, 1.0);
@@ -198,24 +192,17 @@ vec4 filterColor(vec3 N)
// apply the bias to the lod
lod += u_lodBias;
- lod = clamp(lod, 0, max_probe_lod);
+ lod = clamp(lod, 0, 7);
// sample lambertian at a lower resolution to avoid fireflies
vec4 lambertian = textureLod(reflectionProbes, vec4(H, sourceIdx), lod);
color += lambertian;
}
- if(weight != 0.0f)
- {
- color /= weight;
- }
- else
- {
- color /= float(u_sampleCount);
- }
+ color /= float(u_sampleCount);
+
+ color.rgb *= ambiance_scale;
- color = min(color*1.9, vec4(1));
- color = pow(color, vec4(0.5));
return color;
}
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 9c871514f7..254c74df79 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -676,7 +676,7 @@ void LLDrawPoolBump::renderBump(U32 pass)
//static
void LLDrawPoolBump::endBump(U32 pass)
{
- gObjectBumpProgram.unbind();
+ LLGLSLShader::unbind();
gGL.setSceneBlendType(LLRender::BT_ALPHA);
}
diff --git a/indra/newview/lldrawpoolsimple.cpp b/indra/newview/lldrawpoolsimple.cpp
index 3a659e0efc..7a8b2b4b35 100644
--- a/indra/newview/lldrawpoolsimple.cpp
+++ b/indra/newview/lldrawpoolsimple.cpp
@@ -358,7 +358,7 @@ void LLDrawPoolGrass::beginRenderPass(S32 pass)
else
{
gGL.flush();
- LLGLSLShader::bindNoShader();
+ LLGLSLShader::unbind();
}
}
diff --git a/indra/newview/lldynamictexture.cpp b/indra/newview/lldynamictexture.cpp
index d1f9e7a943..7fdb3fbdaf 100644
--- a/indra/newview/lldynamictexture.cpp
+++ b/indra/newview/lldynamictexture.cpp
@@ -195,7 +195,7 @@ BOOL LLViewerDynamicTexture::updateAllInstances()
gPipeline.mBake.clear();
}
- LLGLSLShader::bindNoShader();
+ LLGLSLShader::unbind();
LLVertexBuffer::unbind();
BOOL result = FALSE;
diff --git a/indra/newview/llreflectionmapmanager.cpp b/indra/newview/llreflectionmapmanager.cpp
index ee05849130..e622f54756 100644
--- a/indra/newview/llreflectionmapmanager.cpp
+++ b/indra/newview/llreflectionmapmanager.cpp
@@ -406,7 +406,7 @@ void LLReflectionMapManager::doProbeUpdate()
{
updateNeighbors(mUpdatingProbe);
mUpdatingFace = 0;
- if (mRadiancePass)
+ if (isRadiancePass())
{
mUpdatingProbe = nullptr;
mRadiancePass = false;
@@ -460,12 +460,12 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
}
gGL.setColorMask(true, true);
+ LLGLDepthTest depth(GL_FALSE, GL_FALSE);
+ LLGLDisable cull(GL_CULL_FACE);
+ LLGLDisable blend(GL_BLEND);
// downsample to placeholder map
{
- LLGLDepthTest depth(GL_FALSE, GL_FALSE);
- LLGLDisable cull(GL_CULL_FACE);
-
gReflectionMipProgram.bind();
gGL.matrixMode(gGL.MM_MODELVIEW);
@@ -560,7 +560,7 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
mMipChain[0].bindTarget();
static LLStaticHashedString sSourceIdx("sourceIdx");
- if (mRadiancePass)
+ if (isRadiancePass())
{
//generate radiance map (even if this is not the irradiance map, we need the mip chain for the irradiance map)
gRadianceGenProgram.bind();
@@ -607,16 +607,20 @@ void LLReflectionMapManager::updateProbeFace(LLReflectionMap* probe, U32 face)
gRadianceGenProgram.unbind();
}
- else if (!mRadiancePass)
+ else
{
//generate irradiance map
gIrradianceGenProgram.bind();
S32 channel = gIrradianceGenProgram.enableTexture(LLShaderMgr::REFLECTION_PROBES, LLTexUnit::TT_CUBE_MAP_ARRAY);
mTexture->bind(channel);
+ static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f);
+ static LLStaticHashedString ambiance_scale_str("ambiance_scale");
+
+ gIrradianceGenProgram.uniform1f(ambiance_scale_str, ambiance_scale);
gIrradianceGenProgram.uniform1i(sSourceIdx, sourceIdx);
gIrradianceGenProgram.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mMaxProbeLOD);
-
+
mVertexBuffer->setBuffer();
int start_mip = 0;
// find the mip target to start with based on irradiance map resolution
@@ -726,12 +730,28 @@ void LLReflectionMapManager::updateUniforms()
// see class3/deferred/reflectionProbeF.glsl
struct ReflectionProbeData
{
- LLMatrix4 refBox[LL_MAX_REFLECTION_PROBE_COUNT]; // object bounding box as needed
- LLVector4 refSphere[LL_MAX_REFLECTION_PROBE_COUNT]; //origin and radius of refmaps in clip space
- LLVector4 refParams[LL_MAX_REFLECTION_PROBE_COUNT]; //extra parameters (currently only ambiance)
- GLint refIndex[LL_MAX_REFLECTION_PROBE_COUNT][4];
- GLint refNeighbor[4096];
- GLint refmapCount;
+ // for box probes, matrix that transforms from camera space to a [-1, 1] cube representing the bounding box of
+ // the box probe
+ LLMatrix4 refBox[LL_MAX_REFLECTION_PROBE_COUNT];
+
+ // for sphere probes, origin (xyz) and radius (w) of refmaps in clip space
+ LLVector4 refSphere[LL_MAX_REFLECTION_PROBE_COUNT];
+
+ // extra parameters (currently only ambiance in .x)
+ LLVector4 refParams[LL_MAX_REFLECTION_PROBE_COUNT];
+
+ // indices used by probe:
+ // [i][0] - cubemap array index for this probe
+ // [i][1] - index into "refNeighbor" for probes that intersect this probe
+ // [i][2] - number of probes that intersect this probe, or -1 for no neighbors
+ // [i][3] - priority (probe type stored in sign bit - positive for spheres, negative for boxes)
+ GLint refIndex[LL_MAX_REFLECTION_PROBE_COUNT][4];
+
+ // list of neighbor indices
+ GLint refNeighbor[4096];
+
+ // numbrer of active refmaps
+ GLint refmapCount;
};
mReflectionMaps.resize(mReflectionProbeCount);
@@ -751,7 +771,8 @@ void LLReflectionMapManager::updateUniforms()
LLSettingsSky::ptr_t psky = environment.getCurrentSky();
F32 minimum_ambiance = psky->getTotalReflectionProbeAmbiance();
- F32 ambscale = gCubeSnapshot && !mRadiancePass ? 0.f : 1.f;
+ F32 ambscale = gCubeSnapshot && !isRadiancePass() ? 0.f : 1.f;
+
for (auto* refmap : mReflectionMaps)
{
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index a49bd11ffd..fd27c83270 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -675,6 +675,8 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
LL_PROFILE_ZONE_SCOPED_CATEGORY_SHADER;
LLVector3 light_direction = LLVector3(LLEnvironment::instance().getClampedLightNorm().mV);
+ bool radiance_pass = gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass();
+
LLShaderUniforms* shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_DEFAULT];
{
shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
@@ -682,34 +684,33 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
}
shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_SKY];
- {
- shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
- // Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
- LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
- LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
+ shader->uniform3fv(LLViewerShaderMgr::LIGHTNORM, light_direction);
- // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
- // Keep in Sync!
- // * indra\newview\llsettingsvo.cpp
- // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl
- // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl
- cloud_scroll[0] = -cloud_scroll[0];
- vect_c_p_d1 += cloud_scroll;
- shader->uniform3fv(LLShaderMgr::CLOUD_POS_DENSITY1, LLVector3(vect_c_p_d1.mV));
+ // Legacy? SETTING_CLOUD_SCROLL_RATE("cloud_scroll_rate")
+ LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ LLVector4 cloud_scroll( LLEnvironment::instance().getCloudScrollDelta() );
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+ // SL-13084 EEP added support for custom cloud textures -- flip them horizontally to match the preview of Clouds > Cloud Scroll
+ // Keep in Sync!
+ // * indra\newview\llsettingsvo.cpp
+ // * indra\newview\app_settings\shaders\class2\windlight\cloudsV.glsl
+ // * indra\newview\app_settings\shaders\class1\deferred\cloudsV.glsl
+ cloud_scroll[0] = -cloud_scroll[0];
+ vect_c_p_d1 += cloud_scroll;
+ shader->uniform3fv(LLShaderMgr::CLOUD_POS_DENSITY1, LLVector3(vect_c_p_d1.mV));
- // TODO -- make these getters return vec3s
- LLVector3 sunDiffuse = LLVector3(psky->getSunlightColor().mV);
- LLVector3 moonDiffuse = LLVector3(psky->getMoonlightColor().mV);
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, sunDiffuse);
- shader->uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, moonDiffuse);
+ // TODO -- make these getters return vec3s
+ LLVector3 sunDiffuse = LLVector3(psky->getSunlightColor().mV);
+ LLVector3 moonDiffuse = LLVector3(psky->getMoonlightColor().mV);
+
+ shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, sunDiffuse);
+ shader->uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, moonDiffuse);
+
+ shader->uniform3fv(LLShaderMgr::CLOUD_COLOR, LLVector3(psky->getCloudColor().mV));
- shader->uniform3fv(LLShaderMgr::CLOUD_COLOR, LLVector3(psky->getCloudColor().mV));
- }
-
shader = &((LLShaderUniforms*)ptarget)[LLGLSLShader::SG_ANY];
shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength);
@@ -717,27 +718,20 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform3fv(LLShaderMgr::AMBIENT, LLVector3(ambient.mV));
- if (gCubeSnapshot && !gPipeline.mReflectionMapManager.isRadiancePass())
+ if (radiance_pass)
{ // during an irradiance map update, disable ambient lighting (direct lighting only) and desaturate sky color (avoid tinting the world blue)
shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, LLVector3::zero.mV);
-
- auto max_vec = [](LLVector3 col)
- {
- col.mV[0] = col.mV[1] = col.mV[2] = llmax(llmax(col.mV[0], col.mV[1]), col.mV[2]);
- return col;
- };
- shader->uniform3fv(LLShaderMgr::BLUE_HORIZON_LINEAR, max_vec(linearColor3v(getBlueHorizon() / 2.f))); // note magic number of 2.f comes from SLIDER_SCALE_BLUE_HORIZON_DENSITY
- shader->uniform3fv(LLShaderMgr::BLUE_DENSITY_LINEAR, max_vec(linearColor3v(getBlueDensity() / 2.f)));
}
else
{
shader->uniform3fv(LLShaderMgr::AMBIENT_LINEAR, linearColor3v(getAmbientColor() / 3.f)); // note magic number 3.f comes from SLIDER_SCALE_SUN_AMBIENT
- shader->uniform3fv(LLShaderMgr::BLUE_HORIZON_LINEAR, linearColor3v(getBlueHorizon() / 2.f)); // note magic number of 2.f comes from SLIDER_SCALE_BLUE_HORIZON_DENSITY
- shader->uniform3fv(LLShaderMgr::BLUE_DENSITY_LINEAR, linearColor3v(getBlueDensity() / 2.f));
}
- shader->uniform3fv(LLShaderMgr::SUNLIGHT_LINEAR, linearColor3v(getSunlightColor()));
- shader->uniform3fv(LLShaderMgr::MOONLIGHT_LINEAR,linearColor3v(getMoonlightColor()));
+ shader->uniform3fv(LLShaderMgr::BLUE_HORIZON_LINEAR, linearColor3v(getBlueHorizon() / 2.f)); // note magic number of 2.f comes from SLIDER_SCALE_BLUE_HORIZON_DENSITY
+ shader->uniform3fv(LLShaderMgr::BLUE_DENSITY_LINEAR, linearColor3v(getBlueDensity() / 2.f));
+
+ shader->uniform3fv(LLShaderMgr::SUNLIGHT_LINEAR, linearColor3v(sunDiffuse));
+ shader->uniform3fv(LLShaderMgr::MOONLIGHT_LINEAR,linearColor3v(moonDiffuse));
shader->uniform1f(LLShaderMgr::REFLECTION_PROBE_AMBIANCE, getTotalReflectionProbeAmbiance());
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 03ffe5da48..641df44aeb 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -4023,7 +4023,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
}
if (&camera == LLViewerCamera::getInstance())
- { // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
+ { // a bit hacky, this is the start of the main render frame, figure out delta between last modelview matrix and
// current modelview matrix
glh::matrix4f last_modelview(gGLLastModelView);
glh::matrix4f cur_modelview(gGLModelView);
@@ -4039,7 +4039,6 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
gGLDeltaModelView[i] = m.m[i];
gGLInverseDeltaModelView[i] = n.m[i];
}
-
}
bool occlude = LLPipeline::sUseOcclusion > 1 && do_occlusion;
@@ -4047,7 +4046,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
setupHWLights(nullptr);
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools"); //LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLS);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pools");
LLGLEnable cull(GL_CULL_FACE);
@@ -4096,7 +4095,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
pool_set_t::iterator iter2 = iter1;
if (hasRenderType(poolp->getType()) && poolp->getNumDeferredPasses() > 0)
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pool render"); //LL_RECORD_BLOCK_TIME(FTM_DEFERRED_POOLRENDER);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred pool render");
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
@@ -4156,7 +4155,7 @@ void LLPipeline::renderGeomDeferred(LLCamera& camera, bool do_occlusion)
void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
{
- LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL; //LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLS);
+ LL_PROFILE_ZONE_SCOPED_CATEGORY_DRAWPOOL;
LL_PROFILE_GPU_ZONE("renderGeomPostDeferred");
if (gUseWireframe)
@@ -4192,7 +4191,7 @@ void LLPipeline::renderGeomPostDeferred(LLCamera& camera)
pool_set_t::iterator iter2 = iter1;
if (hasRenderType(poolp->getType()) && poolp->getNumPostDeferredPasses() > 0)
{
- LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender"); //LL_RECORD_BLOCK_TIME(FTM_POST_DEFERRED_POOLRENDER);
+ LL_PROFILE_ZONE_NAMED_CATEGORY_DRAWPOOL("deferred poolrender");
gGLLastMatrix = NULL;
gGL.loadMatrix(gGLModelView);
@@ -5766,6 +5765,15 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
// Ambient
LLColor4 ambient = psky->getTotalAmbient();
+ static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f);
+
+ F32 light_scale = 1.f;
+
+ if (gCubeSnapshot && !mReflectionMapManager.isRadiancePass())
+ { //darken local lights based on brightening of sky lighting
+ light_scale = 1.f / ambiance_scale;
+ }
+
gGL.setAmbientLightColor(ambient);
bool sun_up = environment.getIsSunUp();
@@ -5859,7 +5867,7 @@ void LLPipeline::setupHWLights(LLDrawPool* pool)
}
//send linear light color to shader
- LLColor4 light_color = light->getLightLinearColor();
+ LLColor4 light_color = light->getLightLinearColor()*light_scale;
light_color.mV[3] = 0.0f;
F32 fade = iter->fade;
@@ -8141,6 +8149,15 @@ void LLPipeline::renderDeferredLighting()
return;
}
+ static LLCachedControl<F32> ambiance_scale(gSavedSettings, "RenderReflectionProbeAmbianceScale", 8.f);
+
+ F32 light_scale = 1.f;
+
+ if (gCubeSnapshot && !mReflectionMapManager.isRadiancePass())
+ { //darken local lights based on brightening of sky lighting
+ light_scale = 1.f / ambiance_scale;
+ }
+
LLRenderTarget *screen_target = &mRT->screen;
LLRenderTarget* deferred_light_target = &mRT->deferredLight;
@@ -8374,7 +8391,7 @@ void LLPipeline::renderDeferredLighting()
F32 s = volume->getLightRadius() * 1.5f;
// send light color to shader in linear space
- LLColor3 col = volume->getLightLinearColor();
+ LLColor3 col = volume->getLightLinearColor()*light_scale;
if (col.magVecSquared() < 0.001f)
{
@@ -8468,7 +8485,7 @@ void LLPipeline::renderDeferredLighting()
setupSpotLight(gDeferredSpotLightProgram, drawablep);
// send light color to shader in linear space
- LLColor3 col = volume->getLightLinearColor();
+ LLColor3 col = volume->getLightLinearColor() * light_scale;
gDeferredSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, c);
gDeferredSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, s);
@@ -8543,7 +8560,7 @@ void LLPipeline::renderDeferredLighting()
setupSpotLight(gDeferredMultiSpotLightProgram, drawablep);
// send light color to shader in linear space
- LLColor3 col = volume->getLightLinearColor();
+ LLColor3 col = volume->getLightLinearColor() * light_scale;
gDeferredMultiSpotLightProgram.uniform3fv(LLShaderMgr::LIGHT_CENTER, 1, tc.v);
gDeferredMultiSpotLightProgram.uniform1f(LLShaderMgr::LIGHT_SIZE, light_size_final);
@@ -8955,12 +8972,16 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
LLPipeline::sShadowRender = true;
+ // disable occlusion culling during shadow render
+ U32 saved_occlusion = sUseOcclusion;
+ sUseOcclusion = 0;
+
static const U32 types[] = {
LLRenderPass::PASS_SIMPLE,
LLRenderPass::PASS_FULLBRIGHT,
LLRenderPass::PASS_SHINY,
LLRenderPass::PASS_BUMP,
- LLRenderPass::PASS_FULLBRIGHT_SHINY ,
+ LLRenderPass::PASS_FULLBRIGHT_SHINY,
LLRenderPass::PASS_MATERIAL,
LLRenderPass::PASS_MATERIAL_ALPHA_EMISSIVE,
LLRenderPass::PASS_SPECMAP,
@@ -9151,6 +9172,8 @@ void LLPipeline::renderShadow(glh::matrix4f& view, glh::matrix4f& proj, LLCamera
gGL.popMatrix();
gGLLastMatrix = NULL;
+ // reset occlusion culling flag
+ sUseOcclusion = saved_occlusion;
LLPipeline::sShadowRender = false;
}