diff options
| author | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2026-08-11 21:39:19 -0400 |
|---|---|---|
| committer | Jonathan "Geenz" Goodman <geenz@geenzo.com> | 2026-08-11 21:39:19 -0400 |
| commit | 8cabc33e960ca93fdc1a32c77cf611269d95d51b (patch) | |
| tree | 931fcecac10bf73214efa07cc3d704ba2bd01272 /indra/newview/app_settings | |
| parent | 9b7ab49575b54523128952af6686d17eb6696725 (diff) | |
| parent | d045f9aa32789a35628aced166145c182751acbf (diff) | |
Merge remote-tracking branch 'origin/develop-linux' into geenz/linux-to-develop
Diffstat (limited to 'indra/newview/app_settings')
15 files changed, 311 insertions, 294 deletions
diff --git a/indra/newview/app_settings/llsd.xsd b/indra/newview/app_settings/llsd.xsd index 34612d9faa..34612d9faa 100755..100644 --- a/indra/newview/app_settings/llsd.xsd +++ b/indra/newview/app_settings/llsd.xsd diff --git a/indra/newview/app_settings/message.xml b/indra/newview/app_settings/message.xml index dee3fd72dd..dee3fd72dd 100755..100644 --- a/indra/newview/app_settings/message.xml +++ b/indra/newview/app_settings/message.xml diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index d34a5b3eab..d29e006fdd 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5096,6 +5096,28 @@ <key>Value</key> <integer>0</integer> </map> + <key>MediaPluginPipeWireVolumeCatcher</key> + <map> + <key>Comment</key> + <string>Use PipeWire instead of PulseAudio for controlling web media volume.</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>1</integer> + </map> + <key>MediaPluginForceVLC</key> + <map> + <key>Comment</key> + <string>Force use of VLC based media plugin. (Linux Only)</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>MediaControlFadeTime</key> <map> <key>Comment</key> @@ -7306,7 +7328,7 @@ <key>RenderAnisotropic</key> <map> <key>Comment</key> - <string>Render textures using anisotropic filtering</string> + <string>[OBSOLETE] Render textures using anisotropic filtering</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -7314,6 +7336,17 @@ <key>Value</key> <integer>0</integer> </map> + <key>RenderAnisotropicLevel</key> + <map> + <key>Comment</key> + <string>Anisotropic filtering strength(0(Disable), 2x, 4x, 8x, 16x</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>U32</string> + <key>Value</key> + <real>0</real> + </map> <key>RenderAppleUseMultGL</key> <map> <key>Comment</key> @@ -7530,7 +7563,7 @@ <key>RenderHiDPI</key> <map> <key>Comment</key> - <string>Enable support for HiDPI displays, like Retina (macOS ONLY, requires restart)</string> + <string>Enable support for HiDPI displays, like Retina (macOS and Linux ONLY, requires restart)</string> <key>Persist</key> <integer>1</integer> <key>Type</key> @@ -10205,6 +10238,17 @@ <key>Value</key> <integer>1</integer> </map> + <key>RenderHighPrecisionPostProcess</key> + <map> + <key>Comment</key> + <string>Use 16-bit floating point buffers for post process rendering</string> + <key>Persist</key> + <integer>1</integer> + <key>Type</key> + <string>Boolean</string> + <key>Value</key> + <integer>0</integer> + </map> <key>ReplaySession</key> <map> <key>Comment</key> @@ -13810,7 +13854,7 @@ <key>WLSkyDetail</key> <map> <key>Comment</key> - <string>Controls vertex detail on the WindLight sky. Lower numbers will give better performance and uglier skies.</string> + <string>[OBSOLETE]</string> <key>Persist</key> <integer>1</integer> <key>Type</key> diff --git a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl index 5837308965..0fa4b32fda 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/SMAA.glsl @@ -25,7 +25,6 @@ #extension GL_ARB_texture_rectangle : enable #extension GL_ARB_shader_texture_lod : enable -#extension GL_EXT_gpu_shader4 : enable /*[EXTRA_CODE_HERE]*/ diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 8c51b4a36b..f5200719ae 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -30,9 +30,13 @@ out vec4 frag_data[4]; // The fragment shader for the sky ///////////////////////////////////////////////////////////////////////// -in vec3 vary_CloudColorSun; -in vec3 vary_CloudColorAmbient; -in float vary_CloudDensity; +// In +in vec3 pos; + +in vec2 vary_texcoord0; +in vec2 vary_texcoord1; +in vec2 vary_texcoord2; +in vec2 vary_texcoord3; uniform sampler2D cloud_noise_texture; uniform sampler2D cloud_noise_texture_next; @@ -42,11 +46,26 @@ uniform vec3 cloud_pos_density2; uniform float cloud_scale; uniform float cloud_variance; -in vec2 vary_texcoord0; -in vec2 vary_texcoord1; -in vec2 vary_texcoord2; -in vec2 vary_texcoord3; -in float altitude_blend_factor; +uniform vec3 camPosLocal; + +uniform vec3 lightnorm; +uniform vec3 sunlight_color; +uniform vec3 moonlight_color; +uniform int sun_up_factor; +uniform vec3 ambient_color; +uniform vec3 blue_horizon; +uniform vec3 blue_density; +uniform float haze_horizon; +uniform float haze_density; + +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float max_y; + +uniform vec3 glow; +uniform float sun_moon_glow_factor; + +uniform vec3 cloud_color; vec4 cloudNoise(vec2 uv) { @@ -58,21 +77,111 @@ vec4 cloudNoise(vec2 uv) void main() { + if (cloud_scale < 0.001) + { + discard; + } + // Set variables vec2 uv1 = vary_texcoord0.xy; vec2 uv2 = vary_texcoord1.xy; - - vec3 cloudColorSun = vary_CloudColorSun; - vec3 cloudColorAmbient = vary_CloudColorAmbient; - float cloudDensity = vary_CloudDensity; vec2 uv3 = vary_texcoord2.xy; vec2 uv4 = vary_texcoord3.xy; - if (cloud_scale < 0.001) + // Get relative position + vec3 rel_pos = pos.xyz - camPosLocal.xyz + vec3(0, 50, 0); + + float altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); + + // Set altitude + if (rel_pos.y > 0) { - discard; + rel_pos *= (max_y / rel_pos.y); + } + if (rel_pos.y < 0) + { + altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon + rel_pos *= (-32000. / rel_pos.y); } + // Can normalize then + vec3 rel_pos_norm = normalize(rel_pos); + float rel_pos_len = length(rel_pos); + + // Initialize temp variables + vec3 sunlight = sunlight_color; + vec3 light_atten; + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); + + // Calculate relative weights + vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); + vec3 blue_weight = blue_density / combined_haze; + vec3 haze_weight = haze_density / combined_haze; + + // Compute sunlight from rel_pos & lightnorm (for long rays like sky) + float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); + sunlight *= exp(-light_atten * off_axis); + + // Distance + float density_dist = rel_pos_len * density_multiplier; + + // Transparency (-> combined_haze) + // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati + // compiler gets confused. + combined_haze = exp(-combined_haze * density_dist); + + // Compute haze glow + float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); + // haze_glow is 0 at the sun and increases away from sun + haze_glow = max(haze_glow, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + haze_glow *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + haze_glow = pow(haze_glow, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + haze_glow *= sun_moon_glow_factor; + + // Add "minimum anti-solar illumination" + // For sun, add to glow. For moon, remove glow entirely. SL-13768 + haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); + + // Increase ambient when there are more clouds + vec3 tmpAmbient = ambient_color; + tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= (1. - cloud_shadow); + + // Haze color below cloud + vec3 additiveColorBelowCloud = + (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); + + // CLOUDS + sunlight = sunlight_color; + off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); + sunlight *= exp(-light_atten * off_axis); + + // Cloud color out + vec3 cloudColorSun = (sunlight * haze_glow) * cloud_color; + vec3 cloudColorAmbient = tmpAmbient * cloud_color; + + // Attenuate cloud color by atmosphere + combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds + cloudColorSun *= combined_haze; + cloudColorAmbient *= combined_haze; + vec3 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); + + // Make a nice cloud density based on the cloud_shadow value that was passed in. + float cloudDensity = 2. * (cloud_shadow - 0.25); + + // Combine these to minimize register use + cloudColorAmbient += oHazeColorBelowCloud; + + // Cloud Fragment vec2 disturbance = vec2(cloudNoise(uv1 / 8.0f).x, cloudNoise((uv3 + uv1) / 16.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); vec2 disturbance2 = vec2(cloudNoise((uv1 + uv3) / 4.0f).x, cloudNoise((uv4 + uv2) / 8.0f).x) * cloud_variance * (1.0f - cloud_scale * 0.25f); diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl index c019b5606a..89fbe38af0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsV.glsl @@ -1,5 +1,5 @@ /** - * @file WLCloudsV.glsl + * @file class1/deferred/cloudsV.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code @@ -33,38 +33,15 @@ in vec2 texcoord0; /////////////////////////////////////////////////////////////////////////////// // Output parameters -out vec3 vary_CloudColorSun; -out vec3 vary_CloudColorAmbient; -out float vary_CloudDensity; +out vec3 pos; out vec2 vary_texcoord0; out vec2 vary_texcoord1; out vec2 vary_texcoord2; out vec2 vary_texcoord3; -out float altitude_blend_factor; // Inputs -uniform vec3 camPosLocal; - uniform vec3 lightnorm; -uniform vec3 sunlight_color; -uniform vec3 moonlight_color; -uniform int sun_up_factor; -uniform vec3 ambient_color; -uniform vec3 blue_horizon; -uniform vec3 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float max_y; - -uniform vec3 glow; -uniform float sun_moon_glow_factor; - -uniform vec3 cloud_color; - uniform float cloud_scale; // NOTE: Keep these in sync! @@ -76,6 +53,7 @@ uniform float cloud_scale; void main() { // World / view / projection + pos = position.xyz; gl_Position = modelview_projection_matrix * vec4(position.xyz, 1.0); // Texture coords @@ -92,102 +70,4 @@ void main() vary_texcoord2 = vary_texcoord0 * 16.; vary_texcoord3 = vary_texcoord1 * 16.; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - - altitude_blend_factor = clamp((rel_pos.y + 512.0) / max_y, 0.0, 1.0); - - // Set altitude - if (rel_pos.y > 0) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0) - { - altitude_blend_factor = 0; // SL-11589 Fix clouds drooping below horizon - rel_pos *= (-32000. / rel_pos.y); - } - - // Can normalize then - vec3 rel_pos_norm = normalize(rel_pos); - float rel_pos_len = length(rel_pos); - - // Initialize temp variables - vec3 sunlight = sunlight_color; - vec3 light_atten; - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec3 combined_haze = abs(blue_density) + vec3(abs(haze_density)); - vec3 blue_weight = blue_density / combined_haze; - vec3 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - dot(rel_pos_norm, lightnorm.xyz); - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - haze_glow *= sun_moon_glow_factor; - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (haze_glow + 0.25); - - // Increase ambient when there are more clouds - vec3 tmpAmbient = ambient_color; - tmpAmbient += (1. - tmpAmbient) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= (1. - cloud_shadow); - - // Haze color below cloud - vec3 additiveColorBelowCloud = - (blue_horizon * blue_weight * (sunlight + tmpAmbient) + (haze_horizon * haze_weight) * (sunlight * haze_glow + tmpAmbient)); - - // CLOUDS - sunlight = sunlight_color; - off_axis = 1.0 / max(1e-6, lightnorm.y * 2.); - sunlight *= exp(-light_atten * off_axis); - - // Cloud color out - vary_CloudColorSun = (sunlight * haze_glow) * cloud_color; - vary_CloudColorAmbient = tmpAmbient * cloud_color; - - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - vary_CloudColorSun *= combined_haze; - vary_CloudColorAmbient *= combined_haze; - vec3 oHazeColorBelowCloud = additiveColorBelowCloud * (1. - combined_haze); - - // Make a nice cloud density based on the cloud_shadow value that was passed in. - vary_CloudDensity = 2. * (cloud_shadow - 0.25); - - // Combine these to minimize register use - vary_CloudColorAmbient += oHazeColorBelowCloud; - - // needs this to compile on mac - //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); - - // END CLOUDS } diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 7639a5e6fc..b70d1db499 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -23,13 +23,14 @@ * $/LicenseInfo$ */ +// Outputs +out vec4 frag_data[4]; + // Inputs -in vec3 vary_HazeColor; -in float vary_LightNormPosDot; +in vec3 pos; #ifdef HAS_HDRI in vec4 vary_position; -in vec3 vary_rel_pos; uniform float sky_hdr_scale; uniform float hdri_split_screen; uniform mat3 env_mat; @@ -43,7 +44,27 @@ uniform float moisture_level; uniform float droplet_radius; uniform float ice_level; -out vec4 frag_data[4]; +uniform vec3 camPosLocal; + +uniform vec3 lightnorm; +uniform vec3 sunlight_color; +uniform vec3 moonlight_color; +uniform int sun_up_factor; +uniform vec3 ambient_color; +uniform vec3 blue_horizon; +uniform vec3 blue_density; +uniform float haze_horizon; +uniform float haze_density; + +uniform float cloud_shadow; +uniform float density_multiplier; +uniform float distance_multiplier; +uniform float max_y; + +uniform vec3 glow; +uniform float sun_moon_glow_factor; + +uniform int cube_snapshot; vec3 srgb_to_linear(vec3 c); vec3 linear_to_srgb(vec3 c); @@ -83,12 +104,25 @@ vec3 halo22(float d) void main() { + // Get relative position + vec3 rel_pos = pos.xyz - camPosLocal.xyz + vec3(0, 50, 0); + + // Adj position vector to clamp altitude + if (rel_pos.y > 0.) + { + rel_pos *= (max_y / rel_pos.y); + } + if (rel_pos.y < 0.) + { + rel_pos *= (-32000. / rel_pos.y); + } + vec3 color; #ifdef HAS_HDRI vec3 frag_coord = vary_position.xyz/vary_position.w; if (-frag_coord.x > ((1.0-hdri_split_screen)*2.0-1.0)) { - vec3 pos = normalize(vary_rel_pos); + vec3 pos = normalize(rel_pos); pos = env_mat * pos; vec2 texCoord = vec2(atan(pos.z, pos.x) + PI, acos(pos.y)) / vec2(2.0 * PI, PI); color = textureLod(environmentMap, texCoord.xy, 0).rgb * sky_hdr_scale; @@ -99,15 +133,75 @@ void main() else #endif { - // Potential Fill-rate optimization. Add cloud calculation - // back in and output alpha of 0 (so that alpha culling kills - // the fragment) if the sky wouldn't show up because the clouds - // are fully opaque. + // Normalized + vec3 rel_pos_norm = normalize(rel_pos); + float rel_pos_len = length(rel_pos); + + // Grab this value and pass to frag shader for rainbows + float rel_pos_lightnorm_dot = dot(rel_pos_norm, lightnorm.xyz); + + // Initialize temp variables + vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color + + // Sunlight attenuation effect (hue and brightness) due to atmosphere + // this is used later for sunlight modulation at various altitudes + vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); + + // Calculate relative weights + vec3 combined_haze = max(abs(blue_density) + vec3(abs(haze_density)), vec3(1e-6)); + vec3 blue_weight = blue_density / combined_haze; + vec3 haze_weight = haze_density / combined_haze; + + // Compute sunlight from rel_pos & lightnorm (for long rays like sky) + float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); + sunlight *= exp(-light_atten * off_axis); + + // Distance + float density_dist = rel_pos_len * density_multiplier; + + // Transparency (-> combined_haze) + // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati + // compiler gets confused. + combined_haze = exp(-combined_haze * density_dist); + + // Compute haze glow + float haze_glow = 1.0 - rel_pos_lightnorm_dot; + // haze_glow is 0 at the sun and increases away from sun + haze_glow = max(haze_glow, .001); + // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) + haze_glow *= glow.x; + // Higher glow.x gives dimmer glow (because next step is 1 / "angle") + haze_glow = pow(haze_glow, glow.z); + // glow.z should be negative, so we're doing a sort of (1 / "angle") function + + // Add "minimum anti-solar illumination" + // For sun, add to glow. For moon, remove glow entirely. SL-13768 + haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (sun_moon_glow_factor * (haze_glow + 0.25)); + + // Haze color above cloud + color = (blue_horizon * blue_weight * (sunlight + ambient_color) + + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); + + // Final atmosphere additive + color *= (1. - combined_haze); + + // Increase ambient when there are more clouds + vec3 ambient = ambient_color + max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; + + // Dim sunlight by cloud shadow percentage + sunlight *= max(0.0, (1. - cloud_shadow)); + + // Haze color below cloud + vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) + + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient)); + + // Attenuate cloud color by atmosphere + combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds - color = vary_HazeColor; + // At horizon, blend high altitude sky color towards the darker color below the clouds + color += (add_below_cloud - color) * (1. - sqrt(combined_haze)); - float rel_pos_lightnorm = vary_LightNormPosDot; - float optic_d = rel_pos_lightnorm; + float optic_d = rel_pos_lightnorm_dot; vec3 halo_22 = halo22(optic_d); color.rgb += rainbow(optic_d); color.rgb += halo_22; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index ea00d240df..836ad66098 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -1,5 +1,5 @@ /** - * @file WLSkyV.glsl + * @file class1/deferred/skyV.glsl * * $LicenseInfo:firstyear=2005&license=viewerlgpl$ * Second Life Viewer Source Code @@ -32,36 +32,13 @@ in vec3 position; /////////////////////////////////////////////////////////////////////////////// // Output parameters -out vec3 vary_HazeColor; -out float vary_LightNormPosDot; +out vec3 pos; #ifdef HAS_HDRI out vec4 vary_position; -out vec3 vary_rel_pos; #endif // Inputs -uniform vec3 camPosLocal; - -uniform vec3 lightnorm; -uniform vec3 sunlight_color; -uniform vec3 moonlight_color; -uniform int sun_up_factor; -uniform vec3 ambient_color; -uniform vec3 blue_horizon; -uniform vec3 blue_density; -uniform float haze_horizon; -uniform float haze_density; - -uniform float cloud_shadow; -uniform float density_multiplier; -uniform float distance_multiplier; -uniform float max_y; - -uniform vec3 glow; -uniform float sun_moon_glow_factor; - -uniform int cube_snapshot; // NOTE: Keep these in sync! // indra\newview\app_settings\shaders\class1\deferred\skyV.glsl @@ -70,97 +47,13 @@ uniform int cube_snapshot; void main() { // World / view / projection - vec4 pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - - gl_Position = pos; - - // Get relative position - vec3 rel_pos = position.xyz - camPosLocal.xyz + vec3(0, 50, 0); - -#ifdef HAS_HDRI - vary_rel_pos = rel_pos; - vary_position = pos; -#endif - - // Adj position vector to clamp altitude - if (rel_pos.y > 0.) - { - rel_pos *= (max_y / rel_pos.y); - } - if (rel_pos.y < 0.) - { - rel_pos *= (-32000. / rel_pos.y); - } - - // Normalized - vec3 rel_pos_norm = normalize(rel_pos); - float rel_pos_len = length(rel_pos); - - // Grab this value and pass to frag shader for rainbows - float rel_pos_lightnorm_dot = dot(rel_pos_norm, lightnorm.xyz); - vary_LightNormPosDot = rel_pos_lightnorm_dot; - - // Initialize temp variables - vec3 sunlight = (sun_up_factor == 1) ? sunlight_color : moonlight_color * 0.7; //magic 0.7 to match legacy color - - // Sunlight attenuation effect (hue and brightness) due to atmosphere - // this is used later for sunlight modulation at various altitudes - vec3 light_atten = (blue_density + vec3(haze_density * 0.25)) * (density_multiplier * max_y); - - // Calculate relative weights - vec3 combined_haze = max(abs(blue_density) + vec3(abs(haze_density)), vec3(1e-6)); - vec3 blue_weight = blue_density / combined_haze; - vec3 haze_weight = haze_density / combined_haze; - - // Compute sunlight from rel_pos & lightnorm (for long rays like sky) - float off_axis = 1.0 / max(1e-6, max(0., rel_pos_norm.y) + lightnorm.y); - sunlight *= exp(-light_atten * off_axis); - - // Distance - float density_dist = rel_pos_len * density_multiplier; - - // Transparency (-> combined_haze) - // ATI Bugfix -- can't store combined_haze*density_dist in a variable because the ati - // compiler gets confused. - combined_haze = exp(-combined_haze * density_dist); - - // Compute haze glow - float haze_glow = 1.0 - rel_pos_lightnorm_dot; - // haze_glow is 0 at the sun and increases away from sun - haze_glow = max(haze_glow, .001); - // Set a minimum "angle" (smaller glow.y allows tighter, brighter hotspot) - haze_glow *= glow.x; - // Higher glow.x gives dimmer glow (because next step is 1 / "angle") - haze_glow = pow(haze_glow, glow.z); - // glow.z should be negative, so we're doing a sort of (1 / "angle") function - - // Add "minimum anti-solar illumination" - // For sun, add to glow. For moon, remove glow entirely. SL-13768 - haze_glow = (sun_moon_glow_factor < 1.0) ? 0.0 : (sun_moon_glow_factor * (haze_glow + 0.25)); - - // Haze color above cloud - vec3 color = (blue_horizon * blue_weight * (sunlight + ambient_color) - + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient_color)); - - // Final atmosphere additive - color *= (1. - combined_haze); - - // Increase ambient when there are more clouds - vec3 ambient = ambient_color + max(vec3(0), (1. - ambient_color)) * cloud_shadow * 0.5; - - // Dim sunlight by cloud shadow percentage - sunlight *= max(0.0, (1. - cloud_shadow)); - - // Haze color below cloud - vec3 add_below_cloud = (blue_horizon * blue_weight * (sunlight + ambient) - + (haze_horizon * haze_weight) * (sunlight * haze_glow + ambient)); + pos = position.xyz; - // Attenuate cloud color by atmosphere - combined_haze = sqrt(combined_haze); // less atmos opacity (more transparency) below clouds + vec4 transformed_pos = modelview_projection_matrix * vec4(position.xyz, 1.0); - // At horizon, blend high altitude sky color towards the darker color below the clouds - color += (add_below_cloud - color) * (1. - sqrt(combined_haze)); + gl_Position = transformed_pos; - // Haze color above cloud - vary_HazeColor = color; + #ifdef HAS_HDRI + vary_position = transformed_pos; + #endif } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl index 5d770948c5..36eac9ed51 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsVarsV.glsl @@ -27,10 +27,10 @@ out vec3 vary_AdditiveColor; out vec3 vary_AtmosAttenuation; -vec3 additive_color; -vec3 atmos_attenuation; -vec3 sunlit_color; -vec3 amblit_color; +vec3 additive_color = vec3(1.0, 1.0, 1.0); +vec3 atmos_attenuation = vec3(1.0, 1.0, 1.0); +vec3 sunlit_color = vec3(1.0, 1.0, 1.0); +vec3 amblit_color = vec3(1.0, 1.0, 1.0); vec3 getSunlitColor() { diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl index 53bd0c741f..69c9e9ff84 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl @@ -255,8 +255,8 @@ void main() vec3 amblit_linear = amblit; vec3 irradiance = amblit; - vec3 glossenv; - vec3 legacyenv; + vec3 glossenv = vec3(0.0); + vec3 legacyenv = vec3(0.0); sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, frag, pos.xyz, norm.xyz, 0.0, 0.0, true, amblit_linear); diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl index 0418f99459..5b5827fd67 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl @@ -188,8 +188,8 @@ void main() vec3 radiance = vec3(0); sampleReflectionProbes(irradiance, radiance, vary_position.xy*0.5+0.5, pos.xyz, norm.xyz, gloss, true, amblit); - vec3 diffuseColor; - vec3 specularColor; + vec3 diffuseColor = vec3(0.0); + vec3 specularColor = vec3(0.0); calcDiffuseSpecular(col.rgb, metallic, diffuseColor, specularColor); vec3 v = -normalize(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl index 03dc3d7113..32b788d433 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl @@ -78,9 +78,9 @@ void main() float env_intensity = vertex_color.a; - vec3 ambenv; - vec3 glossenv; - vec3 legacyenv; + vec3 ambenv = vec3(1.0); + vec3 glossenv = vec3(0.0); + vec3 legacyenv = vec3(0.0); vec3 norm = normalize(vary_texcoord1.xyz); vec4 spec = vec4(0,0,0,0); sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, vec2(0), pos.xyz, norm.xyz, spec.a, env_intensity, false, amblit); diff --git a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl index 65616e7835..1738cbf9a2 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/materialF.glsl @@ -337,8 +337,8 @@ void main() vec3 amblit_linear = amblit; vec3 ambenv = amblit; - vec3 glossenv; - vec3 legacyenv; + vec3 glossenv = vec3(0.0); + vec3 legacyenv = vec3(0.0); sampleReflectionProbesLegacy(ambenv, glossenv, legacyenv, pos.xy*0.5+0.5, pos.xyz, norm.xyz, glossiness, env, true, amblit_linear); color = ambenv; diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl index 948387a6ed..b3b8d295b9 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl @@ -180,8 +180,8 @@ void main() adjustIrradiance(irradiance, ambocc); - vec3 diffuseColor; - vec3 specularColor; + vec3 diffuseColor = vec3(0.0); + vec3 specularColor = vec3(0.0); calcDiffuseSpecular(baseColor.rgb, metallic, diffuseColor, specularColor); vec3 v = -normalize(pos.xyz); diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 349f3b9a67..d5e00f3a3f 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -122,9 +122,7 @@ vec3 atmosLighting(vec3 light); vec3 scaleSoftClip(vec3 light); vec3 toneMapNoExposure(vec3 color); -vec3 vN, vT, vB; - -vec3 transform_normal(vec3 vNt) +vec3 transform_normal(vec3 vN, vec3 vT, vec3 vB, vec3 vNt) { return normalize(vNt.x * vT + vNt.y * vB + vNt.z * vN); } @@ -184,9 +182,9 @@ void main() { mirrorClip(vary_position); - vN = vary_normal; - vT = vary_tangent; - vB = cross(vN, vT); + vec3 vN = vary_normal; + vec3 vT = vary_tangent; + vec3 vB = cross(vN, vT); vec3 pos = vary_position.xyz; float linear_depth = 1 / -pos.z; @@ -222,14 +220,14 @@ void main() vec3 waver = wavef*3; - vec3 up = transform_normal(vec3(0,0,1)); + vec3 up = transform_normal(vN, vT, vB, vec3(0,0,1)); float vdu = -dot(viewVec, up)*2; vec3 wave_ibl = wavef * normScale; wave_ibl.z *= 2.0; - wave_ibl = transform_normal(normalize(wave_ibl)); + wave_ibl = transform_normal(vN, vT, vB, normalize(wave_ibl)); - vec3 norm = transform_normal(normalize(wavef)); + vec3 norm = transform_normal(vN, vT, vB, normalize(wavef)); vdu = clamp(vdu, 0, 1); //wavef.z *= max(vdu*vdu*vdu, 0.1); @@ -237,7 +235,7 @@ void main() wavef = normalize(wavef); //wavef = vec3(0, 0, 1); - wavef = transform_normal(wavef); + wavef = transform_normal(vN, vT, vB, wavef); float dist2 = dist; dist = max(dist, 5.0); @@ -312,7 +310,7 @@ void main() vec3 colorEmissive = vec3(0); float ao = 1.0; - vec3 light_dir = transform_normal(lightDir); + vec3 light_dir = transform_normal(vN, vT, vB, lightDir); float NdotV = clamp(abs(dot(norm, v)), 0.001, 1.0); |
