diff options
author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2024-11-28 17:57:30 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-28 17:57:30 -0500 |
commit | c02baded8464781fcb208676610727e677ac6907 (patch) | |
tree | 84f45af956f6c4fed1c28cdfc9445eb74216cd25 | |
parent | 5ac2adfa280ad589de7530c6d72db09c7788b27f (diff) |
#3170 Fix for tonemapping not working with PBR skies.
-rw-r--r-- | indra/llinventory/llsettingssky.cpp | 17 | ||||
-rw-r--r-- | indra/llinventory/llsettingssky.h | 3 | ||||
-rw-r--r-- | indra/newview/llsettingsvo.cpp | 6 | ||||
-rw-r--r-- | indra/newview/pipeline.cpp | 12 |
4 files changed, 27 insertions, 11 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 17d259a163..50b458de14 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -1180,6 +1180,7 @@ void LLSettingsSky::loadValuesFromLLSD() mHDRMax = 2.0f; mHDRMin = 0.5f; mHDROffset = 1.0f; + mTonemapMix = 1.0f; mSunTextureId = settings[SETTING_SUN_TEXTUREID].asUUID(); mMoonTextureId = settings[SETTING_MOON_TEXTUREID].asUUID(); @@ -2055,6 +2056,22 @@ F32 LLSettingsSky::getHDROffset() const return mHDROffset; } +F32 LLSettingsSky::getTonemapMix() const +{ + if (mCanAutoAdjust) + return 0.0f; + + return mTonemapMix; +} + +void LLSettingsSky::setTonemapMix(F32 mix) +{ + if (mCanAutoAdjust) + return; + + mTonemapMix = mix; +} + void LLSettingsSky::setGamma(F32 val) { mGamma = val; diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index f61f8af116..4c635fd946 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -212,6 +212,8 @@ public: F32 getHDRMin() const; F32 getHDRMax() const; F32 getHDROffset() const; + F32 getTonemapMix() const; + void setTonemapMix(F32 mix); void setGamma(F32 val); @@ -384,6 +386,7 @@ protected: F32 mCloudVariance; F32 mCloudShadow; F32 mCloudScale; + F32 mTonemapMix; F32 mHDROffset; F32 mHDRMax; F32 mHDRMin; diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index b1bef4c4d8..836b181623 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -804,10 +804,16 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force) static LLCachedControl<F32> sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f); static LLCachedControl<F32> sunlight_hdr_scale(gSavedSettings, "RenderHDRSkySunlightScale", 1.5f); static LLCachedControl<F32> ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f); + static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f); // sky is a "classic" sky following pre SL 7.0 shading bool classic_mode = psky->canAutoAdjust(); + if (!classic_mode) + { + psky->setTonemapMix(tonemap_mix_setting); + } + shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, hdr ? sunlight_hdr_scale : sunlight_scale); shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale); shader->uniform1i(LLShaderMgr::CLASSIC_MODE, classic_mode); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 037dfd1d66..1221601c97 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -7150,17 +7150,7 @@ void LLPipeline::tonemap(LLRenderTarget* src, LLRenderTarget* dst) static LLCachedControl<U32> tonemap_type_setting(gSavedSettings, "RenderTonemapType", 0U); shader.uniform1i(tonemap_type, tonemap_type_setting); - - static LLCachedControl<F32> tonemap_mix_setting(gSavedSettings, "RenderTonemapMix", 1.f); - if (psky->canAutoAdjust()) - { - // Legacy skies - shader.uniform1f(tonemap_mix, 0.f); - } - else - { - shader.uniform1f(tonemap_mix, tonemap_mix_setting()); - } + shader.uniform1f(tonemap_mix, psky->getTonemapMix()); mScreenTriangleVB->setBuffer(); mScreenTriangleVB->drawArrays(LLRender::TRIANGLES, 0, 3); |