summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-04-26 20:47:04 -0500
committerRunitaiLinden <davep@lindenlab.com>2023-04-26 20:47:04 -0500
commit88adfdcee4941dbc57725c8251c3435fbca1792e (patch)
treea1393ef38b2a3683cb19c5e6898af5959bf450f3 /indra/newview/app_settings/shaders
parent879ca2f6a0353fa2f8f59d81dde19546399d8bc7 (diff)
DRTVWR-559 Add "No Post" mode and refactor "Scene Gamma" into "Brightness" for adjusting legacy gamma when probe ambiance is 0 and dynamic exposure when probe ambiance is not zero.
Diffstat (limited to 'indra/newview/app_settings/shaders')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/srgbF.glsl5
2 files changed, 14 insertions, 22 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
index 82d7bb9835..31cad591be 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/postDeferredGammaCorrect.glsl
@@ -104,20 +104,20 @@ vec3 toneMapACES_Hill(vec3 color)
uniform float exposure;
uniform float gamma;
-vec3 legacy_adjust_post(vec3 c);
-
-vec3 toneMap(vec3 color, float gs)
+vec3 toneMap(vec3 color)
{
+#ifndef NO_POST
float exp_scale = texture(exposureMap, vec2(0.5,0.5)).r;
- color *= exposure * exp_scale * gs;
+ color *= exposure * exp_scale;
color = toneMapACES_Hill(color);
+#else
+ color *= 0.6;
+#endif
color = linear_to_srgb(color);
- color = legacy_adjust_post(color);
-
return color;
}
@@ -170,22 +170,19 @@ 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, legacyGammaApprox());
-
+ diff.rgb = toneMap(diff.rgb);
+
+#if LEGACY_GAMMA
+#ifndef NO_POST
+ diff.rgb = legacyGamma(diff.rgb);
+#endif
+#endif
+
vec2 tc = vary_fragcoord.xy*screen_res*4.0;
vec3 seed = (diff.rgb+vec3(1.0))*vec3(tc.xy, tc.x+tc.y);
vec3 nz = vec3(noise(seed.rg), noise(seed.gb), noise(seed.rb));
diff --git a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
index 35f2395ef1..3817633df0 100644
--- a/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/srgbF.glsl
@@ -128,8 +128,3 @@ vec3 legacy_adjust_fullbright(vec3 c)
return c / exp_scale * 1.34;
}
-
-vec3 legacy_adjust_post(vec3 c)
-{
- return c;
-}