summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class3
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-06-01 19:49:23 -0500
committerGitHub <noreply@github.com>2023-06-01 19:49:23 -0500
commit50ec54831de88926ca13c9a72d89006ceda6c355 (patch)
tree7f1efd2a8555fc419af29eaf0a47b4828df0d22b /indra/newview/app_settings/shaders/class3
parent8d20d61b4d305b985de4837bb0ed3ddaedb208d1 (diff)
DRTVWR-559 Revert skies to be very close to release and disable tone mapping when probe ambiance is zero.
Hack for desaturating legacy materials has been removed for performance and quality reasons. Adds a new setting for auto adjusting legacy skies. This is the PBR "opt out" button. If disabled, legacy skies will disable tonemapping, automatic probe ambiance, and HDR/exposure. If enabled, legacy skies will behave as if probe ambiance and HDR scale are 1.0, and ambient will be cut in half. HDR scale will act as a sky brightener, but will automatically adjust dynamic exposure so the sky will be properly exposed. If you want relatively even exposure all the time, set HDR Scale to 1.0. If you want a high range of exposures between indoor/dark areas and outdoor/bright areas, increase HDR Scale. Also tuned up SSAO (thanks Rye!). Reviewed with Brad.
Diffstat (limited to 'indra/newview/app_settings/shaders/class3')
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl36
2 files changed, 25 insertions, 15 deletions
diff --git a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
index 1c79748b49..0d77e88831 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/fullbrightShinyF.glsl
@@ -42,7 +42,7 @@ uniform samplerCube environmentMap;
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
vec3 legacy_adjust_fullbright(vec3 c);
vec3 legacy_adjust(vec3 c);
-void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten, bool use_ao);
+void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec3 linear_to_srgb(vec3 c);
vec3 srgb_to_linear(vec3 c);
@@ -71,7 +71,7 @@ void main()
vec3 additive;
vec3 atten;
vec3 pos = vary_position;
- calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten, false);
+ calcAtmosphericVars(pos.xyz, vec3(0), 1.0, sunlit, amblit, additive, atten);
float env_intensity = vertex_color.a;
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 3945e34d7a..53c5b1b801 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -44,9 +44,14 @@ uniform sampler2D lightFunc;
uniform float blur_size;
uniform float blur_fidelity;
+#if defined(HAS_SSAO)
+uniform float ssao_irradiance_scale;
+uniform float ssao_irradiance_max;
+#endif
+
// Inputs
uniform mat3 env_mat;
-
+uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
uniform vec3 moon_dir;
uniform int sun_up_factor;
@@ -112,6 +117,16 @@ vec3 pbrPunctual(vec3 diffuseColor, vec3 specularColor,
vec3 l); //surface point to light
+void adjustIrradiance(inout vec3 irradiance, vec3 amblit_linear, float ambocc)
+{
+ // use sky settings ambient or irradiance map sample, whichever is brighter
+ irradiance = max(amblit_linear, irradiance);
+
+#if defined(HAS_SSAO)
+ irradiance = mix(ssao_effect_mat * min(irradiance.rgb*ssao_irradiance_scale, vec3(ssao_irradiance_max)), irradiance.rgb, ambocc);
+#endif
+}
+
void main()
{
vec2 tc = vary_fragcoord.xy;
@@ -173,7 +188,7 @@ void main()
vec3 orm = texture(specularRect, tc).rgb;
float perceptualRoughness = orm.g;
float metallic = orm.b;
- float ao = orm.r * ambocc;
+ float ao = orm.r;
vec3 colorEmissive = texture(emissiveRect, tc).rgb;
// PBR IBL
@@ -181,9 +196,7 @@ void main()
sampleReflectionProbes(irradiance, radiance, tc, pos.xyz, norm.xyz, gloss);
- // Take maximium of legacy ambient vs irradiance sample as irradiance
- // NOTE: ao is applied in pbrIbl (see pbrBaseLight), do not apply here
- irradiance = max(amblit_linear,irradiance);
+ adjustIrradiance(irradiance, amblit_linear, ambocc);
vec3 diffuseColor;
vec3 specularColor;
@@ -203,17 +216,15 @@ void main()
//should only be true of WL sky, just port over base color value
color = texture(emissiveRect, tc).rgb;
color = srgb_to_linear(color);
- if (sun_up_factor > 0)
- {
- color *= sky_hdr_scale + 1.0;
- }
+ color *= sky_hdr_scale;
}
else
{
// legacy shaders are still writng sRGB to gbuffer
baseColor.rgb = legacy_adjust(baseColor.rgb);
-
+
baseColor.rgb = srgb_to_linear(baseColor.rgb);
+
spec.rgb = srgb_to_linear(spec.rgb);
float da = clamp(dot(norm.xyz, light_dir.xyz), 0.0, 1.0);
@@ -224,11 +235,10 @@ void main()
sampleReflectionProbesLegacy(irradiance, glossenv, legacyenv, tc, pos.xyz, norm.xyz, spec.a, envIntensity);
- // use sky settings ambient or irradiance map sample, whichever is brighter
- irradiance = max(amblit_linear, irradiance);
+ adjustIrradiance(irradiance, amblit_linear, ambocc);
// apply lambertian IBL only (see pbrIbl)
- color.rgb = irradiance * ambocc;
+ color.rgb = irradiance;
vec3 sun_contrib = min(da, scol) * sunlit_linear;
color.rgb += sun_contrib;