diff options
author | Graham Linden <graham@lindenlab.com> | 2019-03-03 10:42:19 -0800 |
---|---|---|
committer | Graham Linden <graham@lindenlab.com> | 2019-03-03 10:42:19 -0800 |
commit | 4c3050a3953153aa8753fc10706ad2ef464f3e3d (patch) | |
tree | 78ded9c452348f749c8dac87f416aa433f4ca963 /indra/newview/app_settings/shaders | |
parent | d90b16d350fba72e5011768ee8eb8b3289962dc5 (diff) |
SL-10664, SL-10666
Fix up culling issues from perf work and fix Depth of Field rendering to get depth values properly.
Baseline for performance work.
Diffstat (limited to 'indra/newview/app_settings/shaders')
15 files changed, 72 insertions, 16 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl index 6e1f0f201b..9191787273 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl @@ -118,7 +118,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec da *= spot*spot; // GL_SPOT_EXPONENT=2 // to match spotLight (but not multiSpotLight) *sigh* - float lit = max(min(da, shadow) * dist_atten,0.0); + float lit = max(da * dist_atten,0.0); col = lit * light_col * diffuse; float amb_da = ambiance; diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl index e2ebd928ef..4db2b9ae54 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl @@ -119,7 +119,7 @@ vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spe da *= clamp(da, 0.0, 1.0); da *= pow(da, 1.0 / 1.3); - float lit = max(min(da,shadow) * dist_atten, 0.0); + float lit = max(da * dist_atten, 0.0); col = light_col*lit*diffuse; diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl index be5e3538a7..628f73da59 100644 --- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl +++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl @@ -167,6 +167,8 @@ void main() vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz); +color.rgb = max(fb.rgb, refcol.rgb); + frag_data[0] = vec4(color.rgb, 1); // diffuse frag_data[1] = vec4(0); // speccolor, spec frag_data[2] = vec4(encode_normal(screenspacewavef.xyz*0.5+0.5), 0.05, 0);// normalxy, 0, 0 diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl index 3572331d74..10407eeb02 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersF.glsl @@ -25,9 +25,11 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { + if (no_atmo == 1) return light + vec3(0.66); return light + light_ambient.rgb; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl index 7e4855b7c6..14034bccae 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsHelpersV.glsl @@ -25,9 +25,11 @@ uniform vec4 sunlight_color; uniform vec4 light_ambient; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { + if (no_atmo == 1) return light + vec3(0.66); return light + light_ambient.rgb; } diff --git a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl index 9917ba8d3b..667301443a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/gammaF.glsl @@ -23,6 +23,7 @@ * $/LicenseInfo$ */ +uniform int no_atmo; uniform vec4 gamma; vec3 scaleSoftClipFrag(vec3 light) diff --git a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl index f61194db6d..e2b391cb7a 100644 --- a/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class1/windlight/transportF.glsl @@ -23,6 +23,8 @@ * $/LicenseInfo$ */ +uniform int no_atmo; + vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { /* stub function for fallback compatibility on class1 hardware */ diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl index 0f6bf38388..275bc829a7 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl @@ -211,8 +211,10 @@ void main() dlit = color.rgb * plcol.rgb * plcol.a; col = dlit*lit*diff_tex*shadow; - amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; - amb_da = min(amb_da,shadow); + amb_da += (da*0.5) * proj_ambiance; + amb_da += (da*da*0.5 + 0.5) * proj_ambiance; + //amb_da += (da*0.5)*(1.0-shadow)*proj_ambiance; + //amb_da = min(amb_da,shadow); } //float diff = clamp((proj_range-proj_focus)/proj_range, 0.0, 1.0); diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl index 415c894a43..d220bda332 100644 --- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl +++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl @@ -120,7 +120,7 @@ void main() calcFragAtmospherics(pos.xyz, ambocc, sunlit, amblit, additive, atten); - float ambient = min(abs(da), 1.0); + float ambient = abs(da); ambient *= 0.5; ambient *= ambient; ambient = 1.0 - ambient * smoothstep(0.0, 0.3, scol); @@ -155,6 +155,8 @@ void main() col = mix(col.rgb, refcol, envIntensity); } + +vec3 a = col.rgb; if (norm.w < 0.5) { col = mix(atmosFragLighting(col, additive, atten), fullbrightAtmosTransportFrag(col, additive, atten), diffuse.a); @@ -166,8 +168,9 @@ void main() col = fogged.rgb; bloom = fogged.a; #endif - } +//col.rgb = a; + } frag_color.rgb = col.rgb; frag_color.a = bloom; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl index ebb06e0f23..565c00ba79 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl @@ -43,12 +43,17 @@ uniform float max_y; uniform vec4 glow; uniform float scene_light_strength; uniform mat3 ssao_effect_mat; +uniform int no_atmo; uniform float sun_moon_glow_factor; vec3 scaleSoftClipFrag(vec3 light); vec3 atmosFragLighting(vec3 light, vec3 additive, vec3 atten) { + if (no_atmo == 1) + { + return light; + } light *= atten.r; light += additive; return light * 2.0; diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl index c836ca98c5..86743dc306 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl @@ -26,9 +26,11 @@ // Output variables uniform float scene_light_strength; +uniform int no_atmo; vec3 atmosFragAmbient(vec3 light, vec3 amblit) { + if (no_atmo == 1) return light; return amblit + light / 2.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl index 589c95bc96..95b4a76880 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl @@ -33,9 +33,11 @@ vec3 getAtmosAttenuation(); vec3 getPositionEye(); uniform float scene_light_strength; +uniform int no_atmo; vec3 atmosAmbient(vec3 light) { + if (no_atmo == 1) return light + vec3(0.66); return getAmblitColor() + light / 2.0; } diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl index e985c50c67..c0439006f7 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl @@ -26,12 +26,17 @@ uniform vec4 gamma; +uniform int no_atmo; vec3 getAtmosAttenuation(); vec3 getAdditiveColor(); vec3 scaleSoftClipFrag(vec3 light) { + if (no_atmo == 1) + { + return light; + } //soft clip effect: light = 1. - clamp(light, vec3(0.), vec3(1.)); light = 1. - pow(light, gamma.xxx); @@ -45,7 +50,8 @@ vec3 scaleSoftClip(vec3 light) vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) { - return mix(scaleSoftClipFrag(light.rgb), add, atten); + //return mix(scaleSoftClipFrag(light.rgb), add, atten); + return scaleSoftClipFrag(light.rgb); } vec3 fullbrightScaleSoftClip(vec3 light) diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl index d799453712..df731662e8 100644 --- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl @@ -30,21 +30,34 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); +uniform int no_atmo; + vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { + if (no_atmo == 1) + { + return light; + } light *= atten.r; - light += additive; - return light * 2.0; + light += additive * 2.0; + return light; } vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { + if (no_atmo == 1) + { + return light; + } float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosTransportFrag(light.rgb, additive, atten), light.rgb + additive.rgb, brightness * brightness); } -vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) -{ +vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { + if (no_atmo == 1) + { + return light; + } float brightness = dot(light.rgb, vec3(0.33333)); return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } diff --git a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl index 7f74122665..90ab5d2793 100644 --- a/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl +++ b/indra/newview/app_settings/shaders/class3/windlight/transportF.glsl @@ -30,21 +30,35 @@ vec3 getAdditiveColor(); vec3 getAtmosAttenuation(); +uniform int no_atmo; + vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - return (light + additive) * atten * 2.0; + if (no_atmo == 1) + { + return light; + } + return (light + additive) * atten * 2.0; } vec3 fullbrightAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - float brightness = dot(light.rgb, vec3(0.33333)); - return mix(atmosTransportFrag(light.rgb, additive,atten), light.rgb + additive.rgb, brightness * brightness); + if (no_atmo == 1) + { + return light; + } + float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosTransportFrag(light.rgb, additive,atten), light.rgb + additive.rgb, brightness * brightness); } vec3 fullbrightShinyAtmosTransportFrag(vec3 light, vec3 additive, vec3 atten) { - float brightness = dot(light.rgb, vec3(0.33333)); - return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); + if (no_atmo == 1) + { + return light; + } + float brightness = dot(light.rgb, vec3(0.33333)); + return mix(atmosTransportFrag(light.rgb, additive, atten), (light.rgb + additive.rgb) * (2.0 - brightness), brightness * brightness); } vec3 atmosTransport(vec3 light) |