diff options
author | Dave Parks <davep@lindenlab.com> | 2023-03-02 18:36:57 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2023-03-02 18:36:57 -0600 |
commit | 7139444461aae953a263a60f1a093070cc870225 (patch) | |
tree | 8370d8c9c24830c81fcf834be19c95726d0524cd /indra | |
parent | bc7856098f70371dd392c74689df267cce819aa7 (diff) |
SL-19281 Post review cleanup.
Diffstat (limited to 'indra')
8 files changed, 15 insertions, 55 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index cf9ce646d1..fe796a054d 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -52,9 +52,6 @@ VARYING vec2 vary_texcoord2; VARYING vec2 vary_texcoord3; VARYING float altitude_blend_factor; -/// Soft clips the light with a gamma correction -vec3 scaleSoftClip(vec3 light); - vec4 cloudNoise(vec2 uv) { vec4 a = texture2D(cloud_noise_texture, uv); @@ -119,7 +116,6 @@ void main() color = (cloudColorSun*(1.-alpha2) + cloudColorAmbient); color.rgb= max(vec3(0), color.rgb); color.rgb *= 2.0; - color.rgb = scaleSoftClip(color.rgb); /// Gamma correct for WL (soft clip effect). frag_data[0] = vec4(color.rgb, alpha1); diff --git a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl index 0b4a59c866..4bf16b50bf 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/deferredUtil.glsl @@ -74,7 +74,6 @@ const float ONE_OVER_PI = 0.3183098861; vec3 srgb_to_linear(vec3 cs); vec3 atmosFragLightingLinear(vec3 light, vec3 additive, vec3 atten); -vec3 scaleSoftClipFragLinear(vec3 light); float calcLegacyDistanceAttenuation(float distance, float falloff) { @@ -568,7 +567,7 @@ vec3 pbrBaseLight(vec3 diffuseColor, vec3 specularColor, float metallic, vec3 v, specContrib *= sunlit * 2.75 * scol; specContrib += ibl_spec; - color += colorEmissive; //divide by two to correct for magical multiply by two in atmosFragLighting + color += colorEmissive; return color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl index f0522850de..fb97cd95b4 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/emissiveF.glsl @@ -27,14 +27,9 @@ /*[EXTRA_CODE_HERE]*/ -#ifdef DEFINE_GL_FRAGCOLOR out vec4 frag_color; -#else -#define frag_color gl_FragColor -#endif vec3 fullbrightAtmosTransport(vec3 light); -vec3 fullbrightScaleSoftClip(vec3 light); VARYING vec4 vertex_color; VARYING vec2 vary_texcoord0; @@ -46,8 +41,6 @@ void main() vec4 color = diffuseLookup(vary_texcoord0.xy)*vertex_color; color.rgb = fullbrightAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); - frag_color = color; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl index c406c669f2..3a15fd1111 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/fullbrightF.glsl @@ -89,7 +89,6 @@ void main() #ifndef IS_HUD color.rgb = fullbrightAtmosTransport(color.rgb); - color.rgb = fullbrightScaleSoftClip(color.rgb); color.rgb = srgb_to_linear(color.rgb); #endif diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl index e3a201c724..745999fc2f 100644 --- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl +++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl @@ -76,42 +76,9 @@ vec4 applyWaterFogView(vec3 pos, vec4 color) vec4 applyWaterFogViewLinearNoClip(vec3 pos, vec4 color, vec3 sunlit) { - vec3 view = normalize(pos); - //normalize view vector - float es = -(dot(view, waterPlane.xyz)); - - - //find intersection point with water plane and eye vector - - //get eye depth - float e0 = max(-waterPlane.w, 0.0); - - vec3 int_v = waterPlane.w > 0.0 ? view * waterPlane.w / es : vec3(0.0, 0.0, 0.0); - - //get object depth - float depth = length(pos - int_v); - - //get "thickness" of water - float l = max(depth, 0.1); - - float kd = waterFogDensity*1.3; - float ks = waterFogKS; - vec4 kc = waterFogColor; - kc.rgb = srgb_to_linear(kc.rgb); // TODO -- pass in waterFogColor linear - kc.rgb *= sunlit; - - float F = 0.98; - - float t1 = -kd * pow(F, ks * e0); - float t2 = kd + ks * es; - float t3 = pow(F, t2 * l) - 1.0; - - float L = min(t1 / t2 * t3, 1.0); - - float D = pow(0.98, l * kd); - - color.rgb = color.rgb * D + kc.rgb * L; - + color.rgb = linear_to_srgb(color.rgb); + color = applyWaterFogView(pos, color); + color.rgb = srgb_to_linear(color.rgb); return color; } @@ -122,10 +89,7 @@ vec4 applyWaterFogViewLinear(vec3 pos, vec4 color, vec3 sunlit) return color; } - color.rgb = linear_to_srgb(color.rgb); - color = applyWaterFogView(pos, color); - color.rgb = srgb_to_linear(color.rgb); - return color; + return applyWaterFogViewLinearNoClip(pos, color, sunlit); } vec4 applyWaterFogViewLinear(vec3 pos, vec4 color) diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl index 768f422060..34ac0c62dc 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsFuncs.glsl @@ -137,12 +137,15 @@ void calcAtmosphericVars(vec3 inPositionEye, vec3 light_dir, float ambFactor, ou 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 + + // fudge sunlit and amblit to get consistent lighting compared to legacy + // midday before PBR was a thing sunlit = sunlight.rgb * 0.7; amblit = tmpAmbient.rgb * 0.25; + additive *= vec3(1.0 - combined_haze); } - vec3 srgb_to_linear(vec3 col); // provide a touch of lighting in the opposite direction of the sun light @@ -163,6 +166,8 @@ void calcAtmosphericVarsLinear(vec3 inPositionEye, vec3 norm, vec3 light_dir, ou { calcAtmosphericVars(inPositionEye, light_dir, 1.0, sunlit, amblit, additive, atten, false); + // multiply by 2 to get same colors as when the "scaleSoftClip" implementation was doubling color values + // (allows for mixing of light sources other than sunlight e.g. reflection probes) sunlit *= 2.0; amblit *= 2.0; diff --git a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl index c6d649086a..a6a2543915 100644 --- a/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl +++ b/indra/newview/app_settings/shaders/class3/deferred/reflectionProbeF.glsl @@ -681,6 +681,8 @@ void sampleReflectionProbesWater(inout vec3 ambenv, inout vec3 glossenv, vec2 tc, vec3 pos, vec3 norm, float glossiness) { sampleReflectionProbes(ambenv, glossenv, tc, pos, norm, glossiness); + + // fudge factor to get PBR water at a similar luminance ot legacy water glossenv *= 0.25; } diff --git a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl index 991079e77a..7524567f6b 100644 --- a/indra/newview/app_settings/shaders/class3/environment/waterF.glsl +++ b/indra/newview/app_settings/shaders/class3/environment/waterF.glsl @@ -222,7 +222,9 @@ void main() vec4 fb = applyWaterFogViewLinear(viewVec*2048.0, vec4(1.0), sunlit_linear); #endif + // fudge sample on other side of water to be a tad darker fb.rgb *= 0.75; + float metallic = 0.0; float perceptualRoughness = 0.05; float gloss = 1.0 - perceptualRoughness; |