diff options
author | RunitaiLinden <davep@lindenlab.com> | 2023-04-11 15:09:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-11 15:09:58 -0500 |
commit | 2b2154f0217758b27b544d066024d922ba234d51 (patch) | |
tree | fafed45d3e9cc21b04e2babf6bf19d1a476fc88a /indra/newview/app_settings/shaders/class1 | |
parent | 474739226433a74cdca05a949586139a9c9c0bbd (diff) |
SL-19564 Rebalance exposure and sky. Hack legacy diffuse map saturation and brightness to allow ACES Hill all the time.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
5 files changed, 43 insertions, 19 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl index 7ed8e4c8ce..81f1e9aed0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/exposureF.glsl @@ -48,8 +48,11 @@ void main() vec2 tc = vec2(0.5,0.5); float L = textureLod(emissiveRect, tc, 8).r; - - float s = clamp(dynamic_exposure_params.x/L, dynamic_exposure_params.y, dynamic_exposure_params.z); + float max_L = dynamic_exposure_params.x; + L = clamp(L, 0.0, max_L); + L /= max_L; + L = pow(L, 2.0); + float s = mix(dynamic_exposure_params.z, dynamic_exposure_params.y, L); float prev = texture(exposureMap, vec2(0.5,0.5)).r; diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index b5eae3a1d5..11532135dd 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -42,6 +42,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color); #endif vec3 srgb_to_linear(vec3 cs); +vec3 legacy_adjust(vec3 c); vec3 linear_to_srgb(vec3 cl); vec3 fullbrightAtmosTransport(vec3 light); @@ -87,6 +88,7 @@ void main() #endif #ifndef IS_HUD + color.rgb = legacy_adjust(color.rgb); color.rgb = srgb_to_linear(color.rgb); color.rgb = fullbrightAtmosTransport(color.rgb); diff --git a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl index e63e666778..e0eb91480e 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/luminanceF.glsl @@ -44,9 +44,9 @@ float lum(vec3 col) void main() { vec2 tc = vary_fragcoord*0.6+0.2; + tc.y -= 0.1; vec3 c = texture(diffuseRect, tc).rgb + texture(emissiveRect, tc).rgb; float L = lum(c); - frag_color = vec4(L); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl index ae6bdbba95..de766d6bc7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl @@ -105,29 +105,21 @@ vec3 toneMapACES_Hill(vec3 color) uniform float exposure; uniform float gamma; +vec3 legacy_adjust_post(vec3 c); + vec3 toneMap(vec3 color, float gs) { float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r; color *= exposure * exp_scale * gs; -#ifdef TONEMAP_ACES_NARKOWICZ - color = toneMapACES_Narkowicz(color); -#endif - -#ifdef TONEMAP_ACES_HILL color = toneMapACES_Hill(color); -#endif -#ifdef TONEMAP_ACES_HILL_EXPOSURE_BOOST - // boost exposure as discussed in https://github.com/mrdoob/three.js/pull/19621 - // this factor is based on the exposure correction of Krzysztof Narkowicz in his - // implemetation of ACES tone mapping - color *= 1.0/0.6; - color = toneMapACES_Hill(color); -#endif + color = linear_to_srgb(color); - return linear_to_srgb(color); + color = legacy_adjust_post(color); + + return color; } //=============================================================== @@ -181,7 +173,7 @@ vec3 legacyGamma(vec3 color) float legacyGammaApprox() { - //TODO -- figure out how to plumb this in as a uniform + //TODO -- figure out how to plumb this in as a uniform float c = 0.5; float gc = 1.0-pow(c, gamma); diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl index 4a8b892c3a..a3b48e0898 100644 --- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl @@ -72,7 +72,7 @@ vec3 rgb2hsv(vec3 c) vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); float d = q.x - min(q.w, q.y); - float e = 1.0e-10; + float e = 1.0e-3; return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } @@ -82,3 +82,30 @@ vec3 hsv2rgb(vec3 c) vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); } + +vec3 legacy_adjust_no_brighten(vec3 c) +{ + vec3 desat = rgb2hsv(c.rgb); + desat.g *= 0.75; + desat.rgb = hsv2rgb(desat); + return desat; +} + +vec3 legacy_adjust(vec3 c) +{ +#if 1 + vec3 desat = rgb2hsv(c.rgb); + desat.g *= 1.0-(1.0-desat.b)*0.5; + //desat.g = max(desat.g-0.1*c.b-0.1, 0.0); + desat.b += (1.0-desat.b)*0.1f; + desat.rgb = hsv2rgb(desat); + return desat; +#else + return c; +#endif +} + +vec3 legacy_adjust_post(vec3 c) +{ + return c; +} |