summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorPtolemy <ptolemy@lindenlab.com>2022-07-08 07:52:19 -0700
committerPtolemy <ptolemy@lindenlab.com>2022-07-08 07:52:19 -0700
commitbae0fc077b8bebfd159d8426223129581c9cf520 (patch)
tree3537c2f41f6eb7de1730c6451ffdf3f1e0d23e60 /indra/newview
parentdaf3f4f7365137852f952f6fd2a484c81791165a (diff)
SL-17703: PBR: Sun/Moon lighting is in sRGB
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl6
2 files changed, 5 insertions, 2 deletions
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index ea2690ba09..3831eeaa01 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -43,6 +43,7 @@ uniform float sun_moon_glow_factor;
float getAmbientClamp() { return 1.0f; }
+// Returns colors in sRGB
void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
out vec3 atten, bool use_ao)
{
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 822b3e473d..6c70781bee 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -339,10 +339,12 @@ void main()
vec3 sun_contrib = min(da, scol) * sunlit;
#if PBR_USE_ATMOS
- color += sun_contrib;
+ color = linear_to_srgb(color);
+ color += 2.0*sun_contrib; // 2x = Undo legacy hack of calcAtmosphericVars() returning sunlight.rgb * 0.5;
color *= atten.r;
- color += 0.5*additive;
+ color += 2.0*additive;
color = scaleSoftClipFrag(color);
+ color = srgb_to_linear(color);
#endif // PBR_USE_ATMOS
#if DEBUG_PBR_DIFFUSE