summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2022-09-29 00:19:52 -0500
committerDave Parks <davep@lindenlab.com>2022-09-29 00:19:52 -0500
commit411aa9f727efba971c8577cef4d6a31f096a6fea (patch)
tree7cc32ed6726014613c8a38bee9a5d79476249a3c /indra/newview/app_settings
parent2e499bcc40871b6a68700203cc83fe7d81c79c24 (diff)
SL-18190 Fix for haze color being completely wrong (now it's just half wrong).
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl32
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl6
3 files changed, 21 insertions, 21 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index c9e7552312..58a444a763 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -178,9 +178,9 @@ void main()
// TODO: The non-obvious assignment below is copied from the pre-EEP WL shader code
// Unfortunately, fixing it causes a mismatch for EEP, and so it remains... for now
// SL-12975 (unfix pre-EEP broken alpha)
- frag_data[0] = vec4(srgb_to_linear(color.rgb), 0.0); // Effectively, color.rgbr
+ frag_data[0] = vec4(srgb_to_linear(color.rgb), 0.0);
- frag_data[1] = vec4(1.0, 0.2, 0.0, 0.0); // speccolor, spec
+ frag_data[1] = vec4(1.0, 0.1, 0.0, 0.0); // occlusion, roughness, metalness
frag_data[2] = vec4(encode_normal(screenspacewavef.xyz), 0.0, GBUFFER_FLAG_HAS_PBR);// normalxy, env intens, flags (atmo kill)
frag_data[3] = vec4(srgb_to_linear(refcol.rgb),0);
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
index 3d6c15fe55..739f00a8b0 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl
@@ -142,7 +142,7 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou
}
-
+vec3 srgb_to_linear(vec3 col);
// return colors in linear space
void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive,
@@ -155,19 +155,17 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
vec3 rel_pos_norm = normalize(rel_pos);
float rel_pos_len = length(rel_pos);
- vec3 sunlight = (sun_up_factor == 1) ? sunlight_linear : moonlight_linear;
+ vec4 sunlight = (sun_up_factor == 1) ? vec4(sunlight_linear, 0.0) : vec4(moonlight_linear, 0.0);
// sunlight attenuation effect (hue and brightness) due to atmosphere
// this is used later for sunlight modulation at various altitudes
- vec3 light_atten = (blue_density_linear + vec3(haze_density_linear * 0.25)) * (density_multiplier * max_y);
+ vec4 light_atten = (blue_density + vec4(haze_density * 0.25)) * (density_multiplier * max_y);
// I had thought blue_density and haze_density should have equal weighting,
// but attenuation due to haze_density tends to seem too strong
-
- vec3 combined_haze_linear = blue_density_linear + vec3(haze_density_linear);
- vec3 combined_haze = blue_density.rgb + vec3(haze_density);
- vec3 blue_weight = blue_density_linear / combined_haze_linear;
- vec3 haze_weight = vec3(haze_density_linear) / combined_haze_linear;
+ vec4 combined_haze = blue_density + vec4(haze_density);
+ vec4 blue_weight = blue_density / combined_haze;
+ vec4 haze_weight = vec4(haze_density) / combined_haze;
//(TERRAIN) compute sunlight from lightnorm y component. Factor is roughly cosecant(sun elevation) (for short rays like terrain)
float above_horizon_factor = 1.0 / max(1e-6, lightnorm.y);
@@ -180,7 +178,7 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
// ATI Bugfix -- can't store combined_haze*density_dist*distance_multiplier in a variable because the ati
// compiler gets confused.
combined_haze = exp(-combined_haze * density_dist * distance_multiplier);
- combined_haze_linear = exp(-combined_haze_linear * density_dist * distance_multiplier);
+
// final atmosphere attenuation factor
atten = combined_haze.rgb;
@@ -205,24 +203,26 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 light_dir, float ambFact
haze_glow *= sun_moon_glow_factor;
- vec3 amb_color = ambient_linear;
+ //vec4 amb_color = vec4(ambient_linear, 0.0);
+ vec4 amb_color = ambient_color;
// increase ambient when there are more clouds
- vec3 tmpAmbient = amb_color + (vec3(1.) - amb_color) * cloud_shadow * 0.5;
+ vec4 tmpAmbient = amb_color + (vec4(1.) - amb_color) * cloud_shadow * 0.5;
// Similar/Shared Algorithms:
// indra\llinventory\llsettingssky.cpp -- LLSettingsSky::calculateLightSettings()
// indra\newview\app_settings\shaders\class1\windlight\atmosphericsFuncs.glsl -- calcAtmosphericVars()
// haze color
vec3 cs = sunlight.rgb * (1. - cloud_shadow);
- additive = (blue_horizon_linear.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
+ additive = (blue_horizon.rgb * blue_weight.rgb) * (cs + tmpAmbient.rgb) + (haze_horizon * haze_weight.rgb) * (cs * haze_glow + tmpAmbient.rgb);
// brightness of surface both sunlight and ambient
sunlit = sunlight.rgb;
amblit = tmpAmbient.rgb;
- additive *= vec3(1.0 - combined_haze_linear);
+ additive *= vec3(1.0 - combined_haze);
+
+ //sunlit = srgb_to_linear(sunlit);
+ amblit = ambient_linear;
+ additive = srgb_to_linear(additive*1.5);
- sunlit *= 0.8;
- amblit *= 0.05;
- additive *= 0.25;
}
diff --git a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
index 1795f3fd1a..7635897db1 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/softenLightF.glsl
@@ -156,7 +156,7 @@ void main()
vec3 radiance = vec3(0);
sampleReflectionProbes(irradiance, radiance, pos.xyz, norm.xyz, gloss);
- irradiance = max(amblit*2.0*ao,irradiance);
+ irradiance = max(amblit*0.75,irradiance);
vec3 f0 = vec3(0.04);
vec3 baseColor = diffuse.rgb;
@@ -169,8 +169,8 @@ void main()
vec3 v = -normalize(pos.xyz);
float NdotV = clamp(abs(dot(norm.xyz, v)), 0.001, 1.0);
- color.rgb += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, normalize(light_dir)) * sunlit*2.75 * scol;
- color.rgb += colorEmissive;
+ color.rgb += pbrPunctual(diffuseColor, specularColor, perceptualRoughness, metallic, norm.xyz, v, normalize(light_dir)) * sunlit * 2.75 * scol;
+ color.rgb += colorEmissive*0.5;
color.rgb += pbrIbl(diffuseColor, specularColor, radiance, irradiance, ao, NdotV, perceptualRoughness);