diff options
author | Dave Houlton <euclid@lindenlab.com> | 2020-09-16 17:11:01 -0600 |
---|---|---|
committer | Dave Houlton <euclid@lindenlab.com> | 2020-09-16 17:38:56 -0600 |
commit | e8f4017b910ae6276772f540eef80ac0c788cb57 (patch) | |
tree | 702df1071765973e531c1be445fd882907f18437 | |
parent | c0bbac0676e428bba5020e4c3a156edd63045a86 (diff) |
DRTVWR-4976 Misc shader cleanup.
Removed some potential div-by-0 NaNs and a mangled clamp.
5 files changed, 10 insertions, 10 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index b59862bb3b..b7036e02cf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -99,11 +99,11 @@ void main() altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); // Set altitude - if (rel_pos.y > 0.) + if (rel_pos.y > 0) { rel_pos *= (max_y / rel_pos.y); } - else + if (rel_pos.y < 0) { altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon rel_pos *= (-32000. / rel_pos.y); diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index b35a32dbbf..28a1faf24f 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -71,12 +71,12 @@ void main() // Get relative position vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - // Set altitude - if (rel_pos.y > 0.) + // Adj position vector to clamp altitude + if (rel_pos.y > 0) { rel_pos *= (max_y / rel_pos.y); } - else + if (rel_pos.y < 0) { rel_pos *= (-32000. / rel_pos.y); } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl index 05e6e6a9f9..ea2690ba09 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl @@ -49,7 +49,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou vec3 rel_pos = inPositionEye; //(TERRAIN) limit altitude - rel_pos.y = clamp(rel_pos.y, -max_y, max_y); + if (abs(rel_pos.y) > max_y) rel_pos *= (max_y / rel_pos.y); vec3 rel_pos_norm = normalize(rel_pos); float rel_pos_len = length(rel_pos); diff --git a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl index 75e074cbf8..1f881eb44b 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/cloudsV.glsl @@ -99,12 +99,12 @@ void main() // fade clouds beyond a certain point so the bottom of the sky dome doesn't look silly at high altitude altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - // Set altitude + // Adj position vector to clamp altitude if (rel_pos.y > 0.) { rel_pos *= (max_y / rel_pos.y); } - else + if (rel_pos.y < 0.) { rel_pos *= (-32000. / rel_pos.y); } diff --git a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl index 6528066a4e..a0a33b8642 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/skyV.glsl @@ -67,12 +67,12 @@ void main() // Get relative position vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - // Set altitude + // Adj position vector to clamp altitude if (rel_pos.y > 0.) { rel_pos *= (max_y / rel_pos.y); } - else + if (rel_pos.y < 0.) { rel_pos *= (-32000. / rel_pos.y); } |