diff options
| author | RunitaiLinden <davep@lindenlab.com> | 2023-08-22 13:17:58 -0500 | 
|---|---|---|
| committer | RunitaiLinden <davep@lindenlab.com> | 2023-08-22 13:17:58 -0500 | 
| commit | 894c9e0417e7b29aaf31c673ca040dff93eb36ef (patch) | |
| tree | 837909a91622d7c06c9484acece1049ec3c73695 | |
| parent | ec1d1f43540bac02e6cd2e814ee14da0cd33a67c (diff) | |
SL-19842 WIP -- Move sky auto adjustment magic numbers to debug settings.
| -rw-r--r-- | indra/llinventory/llsettingssky.cpp | 5 | ||||
| -rw-r--r-- | indra/llinventory/llsettingssky.h | 2 | ||||
| -rw-r--r-- | indra/llrender/llrender.cpp | 4 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.cpp | 2 | ||||
| -rw-r--r-- | indra/llrender/llshadermgr.h | 2 | ||||
| -rw-r--r-- | indra/newview/app_settings/settings.xml | 67 | ||||
| -rw-r--r-- | indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl | 6 | ||||
| -rw-r--r-- | indra/newview/llsettingsvo.cpp | 22 | ||||
| -rw-r--r-- | indra/newview/pipeline.cpp | 4 | 
9 files changed, 105 insertions, 9 deletions
| diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp index 3f4b15b8b1..976a61fb69 100644 --- a/indra/llinventory/llsettingssky.cpp +++ b/indra/llinventory/llsettingssky.cpp @@ -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(); diff --git a/indra/llinventory/llsettingssky.h b/indra/llinventory/llsettingssky.h index f55e9f0631..7ba7a9ba06 100644 --- a/indra/llinventory/llsettingssky.h +++ b/indra/llinventory/llsettingssky.h @@ -103,6 +103,8 @@ public:      static const LLUUID DEFAULT_ASSET_ID; +    static F32 sAutoAdjustProbeAmbiance; +      typedef PTR_NAMESPACE::shared_ptr<LLSettingsSky> ptr_t;      //--------------------------------------------------------------------- diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp index 8430d13093..ee66122774 100644 --- a/indra/llrender/llrender.cpp +++ b/indra/llrender/llrender.cpp @@ -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);      }  } diff --git a/indra/llrender/llshadermgr.cpp b/indra/llrender/llshadermgr.cpp index 22940dc703..0e7f9e1331 100644 --- a/indra/llrender/llshadermgr.cpp +++ b/indra/llrender/llshadermgr.cpp @@ -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"); diff --git a/indra/llrender/llshadermgr.h b/indra/llrender/llshadermgr.h index ac4b393fb7..79a24773e1 100644 --- a/indra/llrender/llshadermgr.h +++ b/indra/llrender/llshadermgr.h @@ -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" diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 0cd63d9d5f..4612ee1a82 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -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> diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index 437fa0a6d5..53474ded7f 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -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)); diff --git a/indra/newview/llsettingsvo.cpp b/indra/newview/llsettingsvo.cpp index 264359a3a9..9ccac82e63 100644 --- a/indra/newview/llsettingsvo.cpp +++ b/indra/newview/llsettingsvo.cpp @@ -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);  } diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 1620b1ff4c..0b5908a440 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -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);  } | 
