summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-08-27 12:49:18 -0700
committerGraham Linden <graham@lindenlab.com>2019-08-27 12:49:18 -0700
commitad26896a1086536cf47d3cb0041b0410aebf2119 (patch)
tree66cbe552b9ea2d9a0992df0a63ffceacc504b866
parentb660db7324387e2fcc55312e2c4f05897ca2c0eb (diff)
SL-11055
Remedy cloud_shadow and hack halving being done twice to ambient in some cases (i.e. artificial dimunition of necessary bullshit factor).
-rw-r--r--indra/llinventory/llsettingsbase.h2
-rw-r--r--indra/llinventory/llsettingssky.cpp20
-rw-r--r--indra/newview/llsettingsvo.cpp56
-rw-r--r--indra/newview/llsettingsvo.h8
-rw-r--r--indra/newview/pipeline.cpp19
5 files changed, 41 insertions, 64 deletions
diff --git a/indra/llinventory/llsettingsbase.h b/indra/llinventory/llsettingsbase.h
index 8b969d81a6..26e2901968 100644
--- a/indra/llinventory/llsettingsbase.h
+++ b/indra/llinventory/llsettingsbase.h
@@ -353,7 +353,7 @@ protected:
virtual validation_list_t getValidationList() const = 0;
// Apply any settings that need special handling.
- virtual void applySpecial(void *) { };
+ virtual void applySpecial(void *, bool force = false) { };
virtual parammapping_t getParameterMap() const { return parammapping_t(); }
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index 9bbeb00efe..c4ce3af157 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -1326,26 +1326,13 @@ void LLSettingsSky::calculateLightSettings() const
componentMultBy(sunlight, componentExp((light_atten * -1.f) * lighty));
componentMultBy(sunlight, light_transmittance);
- //F32 max_color = llmax(sunlight.mV[0], sunlight.mV[1], sunlight.mV[2]);
- //if (max_color > 1.0f)
- //{
- // sunlight *= 1.0f/max_color;
- //}
-
//increase ambient when there are more clouds
LLColor3 tmpAmbient = ambient + (smear(1.f) - ambient) * cloud_shadow * 0.5;
- componentMultBy(tmpAmbient, light_transmittance);
-
- //tmpAmbient = LLColor3::clamp(tmpAmbient, getGamma(), 1.0f);
- //max_color = llmax(tmpAmbient.mV[0], tmpAmbient.mV[1], tmpAmbient.mV[2]);
- //if (max_color > 1.0f)
- //{
- // tmpAmbient *= 1.0f/max_color;
- //}
//brightness of surface both sunlight and ambient
mSunDiffuse = sunlight;
mSunAmbient = tmpAmbient;
+
F32 haze_horizon = getHazeHorizon();
sunlight *= 1.0 - cloud_shadow;
@@ -1360,12 +1347,11 @@ void LLSettingsSky::calculateLightSettings() const
LLColor3 moonlight_b(0.66, 0.66, 1.2); // scotopic ambient value
componentMultBy(moonlight, componentExp((light_atten * -1.f) * lighty));
- //clampColor(moonlight, getGamma(), 1.0f);
mMoonDiffuse = componentMult(moonlight, light_transmittance) * moon_brightness;
- mMoonAmbient = componentMult(moonlight_b, light_transmittance) * 0.0125f;
+ mMoonAmbient = moonlight_b * 0.0125f;
- mTotalAmbient = mSunAmbient;
+ mTotalAmbient = ambient;
}
LLUUID LLSettingsSky::GetDefaultAssetId()
diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp
index 11bb732be8..bbee94287d 100644
--- a/indra/newview/llsettingsvo.cpp
+++ b/indra/newview/llsettingsvo.cpp
@@ -663,7 +663,7 @@ void LLSettingsVOSky::updateSettings()
gSky.setMoonScale(getMoonScale());
}
-void LLSettingsVOSky::applySpecial(void *ptarget)
+void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{
LLGLSLShader *shader = (LLGLSLShader *)ptarget;
@@ -671,46 +671,38 @@ void LLSettingsVOSky::applySpecial(void *ptarget)
if (shader->mShaderGroup == LLGLSLShader::SG_DEFAULT)
{
- shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV);
- shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV);
+ shader->uniform3fv(LLShaderMgr::WL_CAMPOSLOCAL, 1, LLViewerCamera::getInstance()->getOrigin().mV);
}
else if (shader->mShaderGroup == LLGLSLShader::SG_SKY)
{
- shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV);
+ shader->uniform4fv(LLViewerShaderMgr::LIGHTNORM, 1, light_direction.mV);
- LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
- vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta());
- shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV);
+ LLVector4 vect_c_p_d1(mSettings[SETTING_CLOUD_POS_DENSITY1]);
+ vect_c_p_d1 += LLVector4(LLEnvironment::instance().getCloudScrollDelta());
+ shader->uniform4fv(LLShaderMgr::CLOUD_POS_DENSITY1, 1, vect_c_p_d1.mV);
- LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
+ LLSettingsSky::ptr_t psky = LLEnvironment::instance().getCurrentSky();
- LLColor4 sunDiffuse = psky->getSunlightColor();
- LLColor4 moonDiffuse = psky->getMoonlightColor();
+ LLColor4 sunDiffuse = psky->getSunlightColor();
+ LLColor4 moonDiffuse = psky->getMoonlightColor();
- F32 max_color = llmax(sunDiffuse.mV[0], sunDiffuse.mV[1], sunDiffuse.mV[2]);
- if (max_color > 1.f)
- {
- sunDiffuse *= 1.f/max_color;
- }
- sunDiffuse.clamp();
-
- max_color = llmax(moonDiffuse.mV[0], moonDiffuse.mV[1], moonDiffuse.mV[2]);
- if (max_color > 1.f)
- {
- moonDiffuse *= 1.f/max_color;
- }
- moonDiffuse.clamp();
+ shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV);
+ shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV);
- shader->uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, sunDiffuse.mV);
- shader->uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, moonDiffuse.mV);
-
- LLColor4 cloud_color(psky->getCloudColor(), 1.0);
- shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV);
+ LLColor4 cloud_color(psky->getCloudColor(), 1.0);
+ shader->uniform4fv(LLShaderMgr::CLOUD_COLOR, 1, cloud_color.mV);
}
-
-
shader->uniform1f(LLShaderMgr::SCENE_LIGHT_STRENGTH, mSceneLightStrength);
+
+ LLColor4 ambient(getTotalAmbient());
+ shader->uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV);
+
+ shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, getIsSunUp() ? 1 : 0);
+ shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor());
+ shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier());
+ shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier());
F32 g = getGamma();
F32 display_gamma = gSavedSettings.getF32("RenderDeferredDisplayGamma");
@@ -904,13 +896,13 @@ LLSD LLSettingsVOWater::convertToLegacy(const LLSettingsWater::ptr_t &pwater)
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
-void LLSettingsVOWater::applySpecial(void *ptarget)
+void LLSettingsVOWater::applySpecial(void *ptarget, bool force)
{
LLGLSLShader *shader = (LLGLSLShader *)ptarget;
LLEnvironment& env = LLEnvironment::instance();
- if (shader->mShaderGroup == LLGLSLShader::SG_WATER)
+ if (force || (shader->mShaderGroup == LLGLSLShader::SG_WATER))
{
F32 water_height = env.getWaterHeight();
diff --git a/indra/newview/llsettingsvo.h b/indra/newview/llsettingsvo.h
index 6f105c9d61..1f29013ecf 100644
--- a/indra/newview/llsettingsvo.h
+++ b/indra/newview/llsettingsvo.h
@@ -102,7 +102,7 @@ public:
bool isAdvanced() const { return m_isAdvanced; }
- virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); }
+ virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); }
protected:
LLSettingsVOSky();
@@ -112,7 +112,7 @@ protected:
virtual void updateSettings() override;
- virtual void applySpecial(void *) override;
+ virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
@@ -136,13 +136,13 @@ public:
static LLSD convertToLegacy(const ptr_t &);
- virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader); }
+ virtual void updateShader(LLGLSLShader* shader) { applySpecial(shader, true); }
protected:
LLSettingsVOWater();
virtual void updateSettings() override;
- virtual void applySpecial(void *) override;
+ virtual void applySpecial(void *, bool) override;
virtual parammapping_t getParameterMap() const override;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 7048b921b0..33847b097b 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -116,6 +116,7 @@
#include "llcleanup.h"
#include "llenvironment.h"
+#include "llsettingsvo.h"
#ifdef _DEBUG
// Debug indices is disabled for now for debug performance - djs 4/24/02
@@ -8424,21 +8425,19 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
shader.uniform1f(LLShaderMgr::DEFERRED_DEPTH_CUTOFF, RenderEdgeDepthCutoff);
shader.uniform1f(LLShaderMgr::DEFERRED_NORM_CUTOFF, RenderEdgeNormCutoff);
- shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
- shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
-
-
- LLEnvironment& environment = LLEnvironment::instance();
- LLColor4 ambient(environment.getCurrentSky()->getTotalAmbient());
- shader.uniform4fv(LLShaderMgr::AMBIENT, 1, ambient.mV);
- shader.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
- shader.uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, environment.getCurrentSky()->getSunMoonGlowFactor());
-
if (shader.getUniformLocation(LLShaderMgr::DEFERRED_NORM_MATRIX) >= 0)
{
glh::matrix4f norm_mat = get_current_modelview().inverse().transpose();
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
}
+
+ shader.uniform4fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
+ shader.uniform4fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
+
+ LLEnvironment& environment = LLEnvironment::instance();
+ LLSettingsSky::ptr_t sky = environment.getCurrentSky();
+
+ static_cast<LLSettingsVOSky*>(sky.get())->updateShader(&shader);
}
LLColor3 pow3f(LLColor3 v, F32 f)