summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2
diff options
context:
space:
mode:
authorRunitaiLinden <davep@lindenlab.com>2023-04-04 12:29:12 -0500
committerGitHub <noreply@github.com>2023-04-04 10:29:12 -0700
commit698966f8e7ddcc0b123a83d7c4e381778f8cd8ab (patch)
tree38132d861fbd835d36963e6a4c71048ac957d163 /indra/newview/app_settings/shaders/class2
parent7be7c66b0e43baef64871dac278eac5726e28d25 (diff)
SL-19538 Remove hacky ambiance scale and take the mittens off probe a… (#151)
* SL-19538 Remove hacky ambiance scale and take the mittens off probe ambiance values. Fix for sky brightening being done in sRGB space.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl3
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/transportF.glsl22
6 files changed, 11 insertions, 32 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
index e7322c14fb..70be9a9029 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/alphaF.glsl
@@ -276,9 +276,7 @@ void main()
color.rgb *= diffuse_linear.rgb;
- color.rgb = linear_to_srgb(color.rgb);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
- color.rgb = srgb_to_linear(color.rgb);
vec4 light = vec4(0,0,0,0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
index fb76db99a0..b76443f0f0 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/pbralphaF.glsl
@@ -83,7 +83,6 @@ vec3 linear_to_srgb(vec3 c);
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, out vec3 sunlit, out vec3 amblit, out vec3 atten, out vec3 additive);
vec3 atmosFragLightingLinear(vec3 color, vec3 additive, vec3 atten);
-vec3 scaleSoftClipFragLinear(vec3 color);
void calcHalfVectors(vec3 lv, vec3 n, vec3 v, out vec3 h, out vec3 l, out float nh, out float nl, out float nv, out float vh, out float lightDist);
float calcLegacyDistanceAttenuation(float distance, float falloff);
@@ -236,11 +235,8 @@ void main()
color = pbrBaseLight(diffuseColor, specularColor, metallic, v, norm.xyz, perceptualRoughness, light_dir, sunlit_linear, scol, radiance, irradiance, colorEmissive, ao, additive, atten, spec);
glare += max(max(spec.r, spec.g), spec.b);
- color.rgb = linear_to_srgb(color.rgb);
color.rgb = atmosFragLightingLinear(color.rgb, additive, atten);
- color.rgb = scaleSoftClipFragLinear(color.rgb);
- color.rgb = srgb_to_linear(color.rgb);
-
+
vec3 light = vec3(0);
// Punctual lights
diff --git a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
index baf68e11f4..d21af946e0 100644
--- a/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
+++ b/indra/newview/app_settings/shaders/class2/interface/irradianceGenF.glsl
@@ -32,7 +32,6 @@ uniform samplerCubeArray reflectionProbes;
uniform int sourceIdx;
uniform float max_probe_lod;
-uniform float ambiance_scale;
in vec3 vary_dir;
@@ -200,8 +199,6 @@ vec4 filterColor(vec3 N)
color /= float(u_sampleCount);
- color.rgb *= ambiance_scale;
-
return color;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 1d02498209..22e93496d2 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -30,10 +30,14 @@ vec3 scaleSoftClipFrag(vec3 light);
vec3 srgb_to_linear(vec3 col);
vec3 linear_to_srgb(vec3 col);
+uniform int sun_up_factor;
+
vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten)
{
light *= atten.r;
- light += additive * 2.0;
+ additive = srgb_to_linear(additive*2.0);
+ additive *= sun_up_factor + 1.0;
+ light += additive;
return light;
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
index c2527db218..12a99edc34 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
@@ -63,9 +63,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- float scale = sun_up_factor + 1;
vec3 sunlight = (sun_up_factor == 1) ? sunlight_color: moonlight_color;
- sunlight *= scale;
// sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
@@ -143,7 +141,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
// fudge sunlit and amblit to get consistent lighting compared to legacy
// midday before PBR was a thing
- sunlit = sunlight.rgb / scale;
+ sunlit = sunlight.rgb;
amblit = tmpAmbient.rgb * 0.25;
additive *= vec3(1.0 - combined_haze);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
index 6aa719d200..8221ba9516 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
@@ -30,14 +30,13 @@
vec3 getAdditiveColor();
vec3 getAtmosAttenuation();
-vec3 srgb_to_linear(vec3 col);
-vec3 linear_to_srgb(vec3 col);
+vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten);
+
+// the below implementations are deprecated but remain here as adapters for shaders that haven't been refactored yet
vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- light *= atten.r;
- light += additive * 2.0;
- return light;
+ return atmosFragLighting(light, additive, atten);
}
vec3 atmosTransport(vec3 light)
@@ -45,30 +44,17 @@ vec3 atmosTransport(vec3 light)
return atmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
-vec3 fullbrightAtmosTransportFragLinear(vec3 light, vec3 additive, vec3 atten)
-{
- // same as non-linear version, probably fine
- //float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1;
- //return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive, brightness * brightness);
- return atmosTransportFrag(light, additive, atten);
-}
-
vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten)
{
- //float brightness = dot(light.rgb * 0.5, vec3(0.3333)) + 0.1;
- //return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive, brightness * brightness);
return atmosTransportFrag(light, additive, atten);
}
vec3 fullbrightAtmosTransport(vec3 light)
{
- //return fullbrightAtmosTransportFrag(light, getAdditiveColor(), getAtmosAttenuation());
return atmosTransport(light);
}
vec3 fullbrightShinyAtmosTransport(vec3 light)
{
- //float brightness = dot(light.rgb, vec3(0.33333));
- //return mix(atmosTransport(light.rgb), (light.rgb + getAdditiveColor().rgb) * (2.0 - brightness), brightness * brightness);
return atmosTransport(light);
}