diff options
author | Graham Linden <graham@lindenlab.com> | 2019-06-11 13:03:06 -0700 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-06-11 13:03:06 -0700 |
commit | 653133b9c035e7c34563b199e991189ca3046092 (patch) | |
tree | b5d7b99fc3cacb7f887263edf744463006d9eb1a /indra/newview/app_settings/shaders/class1/deferred | |
parent | c15baecbfbc9baffdeb6ec53b7e4090470514657 (diff) |
SL-11370, SL-11372, SL-11337
Fix culling on Low+ water reflection pass.
Make Mid+ / High use class1 deferred sky again (no rainbows, but faster!).
Fix setting of cloud color for deferred sky/cloud shaders.
Put water reflections back in wrong colorspace for consistency with release.
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
11 files changed, 28 insertions, 14 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index b4de492abc..7dc2fb4cc0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -239,7 +239,7 @@ void main() vec3 sun_contrib = min(final_da, shadow) * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit * 2.0; + color.rgb = amblit; color.rgb *= ambient; #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl index 6ff97fd1e9..d6bd0a7917 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/cloudsF.glsl @@ -55,7 +55,6 @@ VARYING float altitude_blend_factor; /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light); -vec3 linear_to_srgb(vec3 c); vec4 cloudNoise(vec2 uv) { @@ -121,10 +120,13 @@ 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(scaleSoftClip(color.rgb), alpha1); + frag_data[0] = vec4(color.rgb, alpha1); frag_data[1] = vec4(0.0,0.0,0.0,0.0); - frag_data[2] = vec4(0,0,1,0); + frag_data[2] = vec4(0,0,0,1); + + gl_FragDepth = 0.99995f; } diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index 1f0fa97297..571d0dd17a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -326,7 +326,7 @@ void main() vec3 sun_contrib = min(final_da, shadow) * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit * 2.0; + color.rgb = amblit; color.rgb *= ambient; #endif diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl index 367680556a..3607f5a086 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl @@ -58,6 +58,7 @@ uniform mat4 inv_proj; vec4 getPosition(vec2 pos_screen); vec3 getNorm(vec2 pos_screen); +vec3 srgb_to_linear(vec3 c); void main() { @@ -77,6 +78,7 @@ void main() vec4 spec = texture2DRect(specularRect, frag.xy); vec3 diff = texture2DRect(diffuseRect, frag.xy).rgb; + diff.rgb = srgb_to_linear(diff.rgb); float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 npos = normalize(-pos); diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl index c81d633880..e28506dcff 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl @@ -178,6 +178,8 @@ void main() vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + diff_tex.rgb = srgb_to_linear(diff_tex.rgb); + vec3 dlit = vec3(0, 0, 0); float noise = texture2D(noiseMap, frag.xy/128.0).b; diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl index 73bc1141b0..b3ce1ce2e0 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl @@ -89,6 +89,7 @@ void main() float noise = texture2D(noiseMap, frag.xy/128.0).b; vec3 col = texture2DRect(diffuseRect, frag.xy).rgb; + float fa = falloff+1.0; float dist_atten = clamp(1.0-(dist-1.0*(1.0-fa))/fa, 0.0, 1.0); dist_atten *= dist_atten; diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl index 72b7aa9036..894ce8a5e9 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyF.glsl @@ -41,6 +41,8 @@ uniform vec4 gamma; /// Soft clips the light with a gamma correction vec3 scaleSoftClip(vec3 light); +vec3 srgb_to_linear(vec3 c); +vec3 linear_to_srgb(vec3 c); void main() { @@ -51,10 +53,12 @@ void main() vec4 color; color = vary_HazeColor; - color *= 2.; + color.rgb *= 2.0f; + //color.rgb = scaleSoftClip(color.rgb); + //color.rgb = linear_to_srgb(color.rgb); /// Gamma correct for WL (soft clip effect). - frag_data[0] = vec4(scaleSoftClip(color.rgb), 1.0); + frag_data[0] = vec4(color.rgb, 1.0); frag_data[1] = vec4(0.0,0.0,0.0,0.0); frag_data[2] = vec4(0.5,0.5,0.0,1.0); //1.0 in norm.w masks off fog diff --git a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl index 1ab0bc4c20..bdc2a676da 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/skyV.glsl @@ -49,6 +49,7 @@ uniform float haze_density; uniform float cloud_shadow; uniform float density_multiplier; +uniform float distance_multiplier; uniform float max_y; uniform vec4 glow; @@ -88,6 +89,7 @@ void main() vec4 light_atten; float dens_mul = density_multiplier; + float dist_mul = distance_multiplier; // Sunlight attenuation effect (hue and brightness) due to atmosphere // this is used later for sunlight modulation at various altitudes @@ -109,7 +111,7 @@ void main() // Transparency (-> temp1) // ATI Bugfix -- can't store temp1*temp2.z in a variable because the ati // compiler gets confused. - temp1 = exp(-temp1 * temp2.z); + temp1 = exp(-temp1 * temp2.z * dist_mul); // Compute haze glow @@ -153,7 +155,7 @@ void main() // At horizon, blend high altitude sky color towards the darker color below the clouds vary_HazeColor += (additiveColorBelowCloud - vary_HazeColor) * (1. - sqrt(temp1)); - + // won't compile on mac without this being set //vary_AtmosAttenuation = vec3(0.0,0.0,0.0); } diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl index 8c0f74d679..aa55b36d4a 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl @@ -111,8 +111,8 @@ void main() vec3 sun_contrib = final_da * sunlit; #if !defined(AMBIENT_KILL) - color.rgb = amblit; - color.rgb *= ambient; + color.rgb = amblit * 2.0; + color.rgb *= ambient * 0.5; #endif vec3 post_ambient = color.rgb; diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl index 55c740d100..5e985618f7 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl @@ -177,6 +177,8 @@ void main() float da = dot(norm, lv); vec3 diff_tex = texture2DRect(diffuseRect, frag.xy).rgb; + diff_tex.rgb = srgb_to_linear(diff_tex.rgb); + vec4 spec = texture2DRect(specularRect, frag.xy); float noise = texture2D(noiseMap, frag.xy/128.0).b; diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index a9161b2a20..fd5b6989eb 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -144,7 +144,6 @@ void main() vec4 baseCol = texture2D(refTex, refvec4); refcol = mix(baseCol*df2, refcol, dweight); - refcol.rgb = srgb_to_linear(refcol.rgb); //get specular component float spec = clamp(dot(lightDir, (reflect(viewVec,wavef))),0.0,1.0); @@ -159,7 +158,7 @@ void main() //mix with reflection // Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug - color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.4 + 0.6); + color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.999999); vec4 pos = vary_position; @@ -167,7 +166,7 @@ void main() //color.rgb = atmosTransport(color.rgb); color.rgb = scaleSoftClip(color.rgb); - + color.a = spec * sunAngle2; vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); |