SL-19842 WIP -- Move sky auto adjustment magic numbers to debug settings.

master
RunitaiLinden 2023-08-22 13:17:58 -05:00
parent ec1d1f4354
commit 894c9e0417
9 changed files with 105 additions and 9 deletions

View File

@ -32,6 +32,7 @@
#include "llfasttimer.h"
#include "v3colorutil.h"
//=========================================================================
namespace
{
@ -135,6 +136,8 @@ const std::string LLSettingsSky::SETTING_REFLECTION_PROBE_AMBIANCE("reflection_p
const LLUUID LLSettingsSky::DEFAULT_ASSET_ID("651510b8-5f4d-8991-1592-e7eeab2a5a06");
F32 LLSettingsSky::sAutoAdjustProbeAmbiance = 1.f;
static const LLUUID DEFAULT_SUN_ID("32bfbcea-24b1-fb9d-1ef9-48a28a63730f"); // dataserver
static const LLUUID DEFAULT_MOON_ID("d07f6eed-b96a-47cd-b51d-400ad4a1c428"); // dataserver
static const LLUUID DEFAULT_CLOUD_ID("1dc1368f-e8fe-f02d-a08d-9d9f11c1af6b");
@ -1438,7 +1441,7 @@ F32 LLSettingsSky::getReflectionProbeAmbiance(bool auto_adjust) const
{
if (auto_adjust && canAutoAdjust())
{
return 1.f;
return sAutoAdjustProbeAmbiance;
}
return mSettings[SETTING_REFLECTION_PROBE_AMBIANCE].asReal();

View File

@ -103,6 +103,8 @@ public:
static const LLUUID DEFAULT_ASSET_ID;
static F32 sAutoAdjustProbeAmbiance;
typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> ptr_t;
//---------------------------------------------------------------------

View File

@ -975,8 +975,8 @@ void LLRender::syncLightState()
shader->uniform3fv(LLShaderMgr::LIGHT_AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform1i(LLShaderMgr::SUN_UP_FACTOR, sun_primary[0] ? 1 : 0);
//shader->uniform3fv(LLShaderMgr::AMBIENT, 1, mAmbientLightColor.mV);
shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
shader->uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
//shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, diffuse[0].mV);
//shader->uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, diffuse_b[0].mV);
}
}

View File

@ -1267,6 +1267,8 @@ void LLShaderMgr::initAttribsAndUniforms()
mReservedUniforms.push_back("sunlight_color");
mReservedUniforms.push_back("ambient_color");
mReservedUniforms.push_back("sky_hdr_scale");
mReservedUniforms.push_back("sky_sunlight_scale");
mReservedUniforms.push_back("sky_ambient_scale");
mReservedUniforms.push_back("blue_horizon");
mReservedUniforms.push_back("blue_density");
mReservedUniforms.push_back("haze_horizon");

View File

@ -103,6 +103,8 @@ public:
SUNLIGHT_COLOR, // "sunlight_color"
AMBIENT, // "ambient_color"
SKY_HDR_SCALE, // "sky_hdr_scale"
SKY_SUNLIGHT_SCALE, // "sky_sunlight_scale"
SKY_AMBIENT_SCALE, // "sky_ambient_scale"
BLUE_HORIZON, // "blue_horizon"
BLUE_DENSITY, // "blue_density"
HAZE_HORIZON, // "haze_horizon"

View File

@ -10656,6 +10656,73 @@
<key>Value</key>
<real>2.0</real>
</map>
<key>RendeSkyAutoAdjustBlueHorizonScale</key>
<map>
<key>Comment</key>
<string>Blue Horizon Scale value to use when auto-adjusting legacy skies</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>RendeSkyAutoAdjustBlueDensityScale</key>
<map>
<key>Comment</key>
<string>Blue Horizon Scale value to use when auto-adjusting legacy skies</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>RenderSkyAutoAdjustSunColorScale</key>
<map>
<key>Comment</key>
<string>Sun color scalar when auto-adjusting legacy skies</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>RenderSkyAutoAdjustProbeAmbiance</key>
<map>
<key>Comment</key>
<string>Probe ambiance value when auto-adjusting legacy skies</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.0</real>
</map>
<key>RenderSkySunlightScale</key>
<map>
<key>Comment</key>
<string>Sunlight scale fudge factor for matching with pre-PBR viewer</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>1.5</real>
</map>
<key>RenderSkyAmbientScale</key>
<map>
<key>Comment</key>
<string>Ambient scale fudge factor for matching with pre-PBR viewer</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>F32</string>
<key>Value</key>
<real>0.5</real>
</map>
<key>RenderReflectionProbeMaxLocalLightAmbiance</key>
<map>
<key>Comment</key>

View File

@ -40,6 +40,8 @@ uniform vec3 glow;
uniform float scene_light_strength;
uniform float sun_moon_glow_factor;
uniform float sky_hdr_scale;
uniform float sky_sunlight_scale;
uniform float sky_ambient_scale;
float getAmbientClamp() { return 1.0f; }
@ -148,8 +150,8 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou
// multiply to get similar colors as when the "scaleSoftClip" implementation was doubling color values
// (allows for mixing of light sources other than sunlight e.g. reflection probes)
sunlit *= 1.5;
amblit *= 0.5;
sunlit *= sky_sunlight_scale; //1.5;
amblit *= sky_ambient_scale; //0.5;
// override amblit with ambient_color if sky probe ambiance is not zero
amblit = mix(amblit, ambient_color, clamp(sky_hdr_scale-1.0, 0.0, 1.0));

View File

@ -721,6 +721,15 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
static LLCachedControl<bool> should_auto_adjust(gSavedSettings, "RenderSkyAutoAdjustLegacy", true);
static LLCachedControl<F32> auto_adjust_ambient_scale(gSavedSettings, "RenderSkyAutoAdjustAmbientScale", 0.75f);
static LLCachedControl<F32> auto_adjust_hdr_scale(gSavedSettings, "RenderSkyAutoAdjustHDRScale", 2.f);
static LLCachedControl<F32> auto_adjust_blue_horizon_scale(gSavedSettings, "RenderSkyAutoAdjustBlueHorizonScale", 1.f);
static LLCachedControl<F32> auto_adjust_blue_density_scale(gSavedSettings, "RenderSkyAutoAdjustBlueDensityScale", 1.f);
static LLCachedControl<F32> auto_adjust_sun_color_scale(gSavedSettings, "RenderSkyAutoAdjustSunColorScale", 1.f);
static LLCachedControl<F32> auto_adjust_probe_ambiance(gSavedSettings, "RenderSkyAutoAdjustProbeAmbiance", 1.f);
static LLCachedControl<F32> sunlight_scale(gSavedSettings, "RenderSkySunlightScale", 1.5f);
static LLCachedControl<F32> ambient_scale(gSavedSettings, "RenderSkyAmbientScale", 1.5f);
shader->uniform1f(LLShaderMgr::SKY_SUNLIGHT_SCALE, sunlight_scale);
shader->uniform1f(LLShaderMgr::SKY_AMBIENT_SCALE, ambient_scale);
static LLCachedControl<F32> cloud_shadow_scale(gSavedSettings, "RenderCloudShadowAmbianceFactor", 0.125f);
F32 probe_ambiance = getTotalReflectionProbeAmbiance(cloud_shadow_scale);
@ -740,7 +749,16 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
{ // auto-adjust legacy sky to take advantage of probe ambiance
shader->uniform3fv(LLShaderMgr::AMBIENT, (ambient * auto_adjust_ambient_scale).mV);
shader->uniform1f(LLShaderMgr::SKY_HDR_SCALE, auto_adjust_hdr_scale);
probe_ambiance = 1.f; // NOTE -- must match LLSettingsSky::getReflectionProbeAmbiance value for "auto_adjust" true
LLColor3 blue_horizon = getBlueHorizon() * auto_adjust_blue_horizon_scale;
LLColor3 blue_density = getBlueDensity() * auto_adjust_blue_density_scale;
LLColor3 sun_diffuse = getSunDiffuse() * auto_adjust_sun_color_scale;
shader->uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, sun_diffuse.mV);
shader->uniform3fv(LLShaderMgr::BLUE_DENSITY, blue_density.mV);
shader->uniform3fv(LLShaderMgr::BLUE_HORIZON, blue_horizon.mV);
LLSettingsSky::sAutoAdjustProbeAmbiance = auto_adjust_probe_ambiance;
probe_ambiance = auto_adjust_probe_ambiance; // NOTE -- must match LLSettingsSky::getReflectionProbeAmbiance value for "auto_adjust" true
}
else
{
@ -755,7 +773,7 @@ void LLSettingsVOSky::applySpecial(void *ptarget, bool force)
shader->uniform1f(LLShaderMgr::SUN_MOON_GLOW_FACTOR, getSunMoonGlowFactor());
shader->uniform1f(LLShaderMgr::DENSITY_MULTIPLIER, getDensityMultiplier());
shader->uniform1f(LLShaderMgr::DISTANCE_MULTIPLIER, getDistanceMultiplier());
shader->uniform1f(LLShaderMgr::GAMMA, g);
}

View File

@ -7730,8 +7730,8 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
shader.uniformMatrix4fv(LLShaderMgr::DEFERRED_NORM_MATRIX, 1, FALSE, norm_mat.m);
}
shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
//shader.uniform3fv(LLShaderMgr::SUNLIGHT_COLOR, 1, mSunDiffuse.mV);
//shader.uniform3fv(LLShaderMgr::MOONLIGHT_COLOR, 1, mMoonDiffuse.mV);
shader.uniform1f(LLShaderMgr::REFLECTION_PROBE_MAX_LOD, mReflectionMapManager.mMaxProbeLOD);
}