summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2023-04-06 18:58:24 -0500
committerDave Parks <davep@lindenlab.com>2023-04-06 18:58:24 -0500
commitb127e1bd12442953801eb6b53f052aa69d8ee580 (patch)
treecdc2031e8536d5f0d77ce1a1c0fa0800b720c16e /indra
parentbb79718c8f0050569c80a1bfe4dd428321706d1a (diff)
SL-19538 Nudge sun brightness and replace "gamma" with an exposure scaler approximation
Diffstat (limited to 'indra')
-rw-r--r--indra/llinventory/llsettingssky.cpp2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl17
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl4
3 files changed, 16 insertions, 7 deletions
diff --git a/indra/llinventory/llsettingssky.cpp b/indra/llinventory/llsettingssky.cpp
index c976307936..46a48e601f 100644
--- a/indra/llinventory/llsettingssky.cpp
+++ b/indra/llinventory/llsettingssky.cpp
@@ -633,7 +633,7 @@ LLSettingsSky::validation_list_t LLSettingsSky::validationList()
boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f)))));
validation.push_back(Validator(SETTING_REFLECTION_PROBE_AMBIANCE, false, LLSD::TypeReal,
- boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(1.0f)))));
+ boost::bind(&Validator::verifyFloatRange, _1, _2, LLSD(LLSDArray(0.0f)(10.0f)))));
validation.push_back(Validator(SETTING_RAYLEIGH_CONFIG, true, LLSD::TypeArray, &validateRayleighLayers));
validation.push_back(Validator(SETTING_ABSORPTION_CONFIG, true, LLSD::TypeArray, &validateAbsorptionLayers));
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 3cfad5498b..ae6bdbba95 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -105,11 +105,11 @@ vec3 toneMapACES_Hill(vec3 color)
uniform float exposure;
uniform float gamma;
-vec3 toneMap(vec3 color)
+vec3 toneMap(vec3 color, float gs)
{
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
- color *= exposure * exp_scale;
+ color *= exposure * exp_scale * gs;
#ifdef TONEMAP_ACES_NARKOWICZ
color = toneMapACES_Narkowicz(color);
@@ -179,12 +179,21 @@ vec3 legacyGamma(vec3 color)
return color;
}
+float legacyGammaApprox()
+{
+ //TODO -- figure out how to plumb this in as a uniform
+ float c = 0.5;
+ float gc = 1.0-pow(c, gamma);
+
+ return gc/c * gamma;
+}
+
void main()
{
//this is the one of the rare spots where diffuseRect contains linear color values (not sRGB)
vec4 diff = texture2D(diffuseRect, vary_fragcoord);
- diff.rgb = toneMap(diff.rgb);
- diff.rgb = legacyGamma(diff.rgb);
+
+ diff.rgb = toneMap(diff.rgb, legacyGammaApprox());
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
index 12a99edc34..7f6827b160 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
@@ -141,7 +141,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
// fudge sunlit and amblit to get consistent lighting compared to legacy
// midday before PBR was a thing
- sunlit = sunlight.rgb;
+ sunlit = sunlight.rgb * (1.0+sun_up_factor*0.3);
amblit = tmpAmbient.rgb * 0.25;
additive *= vec3(1.0 - combined_haze);
@@ -172,7 +172,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou
sunlit *= 2.0;
// squash ambient to approximate whatever weirdness legacy atmospherics were doing
- amblit = ambient_color * 0.5;
+ amblit = ambient_color * 0.5 * (1.0+sun_up_factor*0.3);
amblit *= ambientLighting(norm, light_dir);
amblit = srgb_to_linear(amblit);