summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/windlight
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2019-02-28 14:06:19 -0800
committerGraham Linden <graham@lindenlab.com>2019-02-28 14:06:19 -0800
commitc1d2416826406631807f153e7de9d2b790b0caa5 (patch)
treee5092c0a9e6ff778d74cb13af44d9c61325fe20f /indra/newview/app_settings/shaders/class2/windlight
parentd7ad30a2d4dfd83f93b0150464214f2df776eb9c (diff)
EEP performance WIP
Mods to improve alpha obj render performance. Removes hacky fix for HUD elements getting atmospherics. Re-orders rendering of glow to remove ~10ms/frame of shader re-re-rebinding. Fix up default classes and basic shader loading (remove unused shared modules).
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/windlight')
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl13
-rw-r--r--indra/newview/app_settings/shaders/class2/windlight/transportF.glsl21
6 files changed, 11 insertions, 46 deletions
diff --git a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
index 565c00ba79..ebb06e0f23 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsF.glsl
@@ -43,17 +43,12 @@ 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 86743dc306..c836ca98c5 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersF.glsl
@@ -26,11 +26,9 @@
// 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 95b4a76880..589c95bc96 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsHelpersV.glsl
@@ -33,11 +33,9 @@ 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/atmosphericsV.glsl b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
index a26752f741..bef7a8827a 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/atmosphericsV.glsl
@@ -64,8 +64,8 @@ void calcAtmospherics(vec3 inPositionEye) {
setPositionEye(P);
//(TERRAIN) limit altitude
- //if (P.y > max_y) P *= (max_y / P.y);
- //if (P.y < -max_y) P *= (-max_y / P.y);
+ if (P.y > max_y) P *= (max_y / P.y);
+ if (P.y < -max_y) P *= (-max_y / P.y);
vec3 tmpLightnorm = lightnorm.xyz;
@@ -134,21 +134,11 @@ void calcAtmospherics(vec3 inPositionEye) {
+ tmpAmbient));
additive = normalize(additive);
- //haze color
- //setAdditiveColor(
- // vec3(blue_horizon * blue_weight * (sunlight*(1.-cloud_shadow) + tmpAmbient)
- // + (haze_horizon * haze_weight) * (sunlight*(1.-cloud_shadow) * temp2.x
- // + tmpAmbient)));
-
//brightness of surface both sunlight and ambient
setSunlitColor(vec3(sunlight * .5));
setAmblitColor(vec3(tmpAmbient * .25));
setAdditiveColor(additive * vec3(1.0 - exp(-temp2.z * distance_multiplier)) * 0.5);
- // vary_SunlitColor = vec3(0);
- // vary_AmblitColor = vec3(0);
- // vary_AdditiveColor = vec4(Pn, 1.0);
-
/*
const float cloudShadowScale = 100.;
// Get cloud uvs for shadowing
diff --git a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
index 143bafc9c9..e985c50c67 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/gammaF.glsl
@@ -26,16 +26,12 @@
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);
@@ -47,12 +43,13 @@ vec3 scaleSoftClip(vec3 light)
return scaleSoftClipFrag(light);
}
-vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten) {
- return scaleSoftClipFrag(light.rgb);
+vec3 fullbrightScaleSoftClipFrag(vec3 light, vec3 add, vec3 atten)
+{
+ return mix(scaleSoftClipFrag(light.rgb), add, atten);
}
vec3 fullbrightScaleSoftClip(vec3 light)
{
- return scaleSoftClipFrag(light);
+ return fullbrightScaleSoftClipFrag(light, getAdditiveColor(), getAtmosAttenuation());
}
diff --git a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
index df731662e8..d799453712 100644
--- a/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
+++ b/indra/newview/app_settings/shaders/class2/windlight/transportF.glsl
@@ -30,34 +30,21 @@
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 * 2.0;
- return light;
+ light += additive;
+ return light * 2.0;
}
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) {
- if (no_atmo == 1)
- {
- return light;
- }
+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);
}