summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-09-30 21:54:10 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-10-01 00:48:25 +0300
commit338aeef7e9e8cfd167489e0707f3e4a884d2c00f (patch)
treec68a38e89e9190ab0293cab09fe045e629913f83
parent994d432e6655d2ed8c45c0d0e804629cb0f650c5 (diff)
SL-14696 SL-13629 Re-add gradation fix after merging a contribution
-rwxr-xr-xdoc/contributions.txt1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/skyF.glsl7
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt
index d74ec13637..1408bab8ca 100755
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -1377,6 +1377,7 @@ Sovereign Engineer
OPEN-343
SL-11625
BUG-229030
+ SL-14696
SL-14705
SL-14706
SL-14707
diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
index 9772063f03..de22312d3c 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl
@@ -54,6 +54,13 @@ vec3 rainbow(float d)
// Unfortunately the texture is inverted, so we need to invert the y coord, but keep the 'interesting'
// part within the same 0.175..0.250 range, i.e. d = (1 - d) - 1.575
d = clamp(-0.575 - d, 0.0, 1.0);
+
+ // With the colors in the lower 1/4 of the texture, inverting the coords leaves most of it inaccessible.
+ // So, we can stretch the texcoord above the colors (ie > 0.25) to fill the entire remaining coordinate
+ // space. This improves gradation, reduces banding within the rainbow interior. (1-0.25) / (0.425/0.25) = 4.2857
+ float interior_coord = max(0.0, d - 0.25) * 4.2857;
+ d = clamp(d, 0.0, 0.25) + interior_coord;
+
float rad = (droplet_radius - 5.0f) / 1024.0f;
return pow(texture2D(rainbow_map, vec2(rad+0.5, d)).rgb, vec3(1.8)) * moisture_level;
}