summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2018-06-12 18:42:07 +0100
committerGraham Linden <graham@lindenlab.com>2018-06-12 18:42:07 +0100
commit67ab0084f87c40bf31d7fadded55cc9ea6299ca2 (patch)
tree1d8119cd8d0b6078724a8128da37c15321a9f703 /indra/newview/app_settings
parent327ded51298599a0057c4a3baf388956ecfed2e5 (diff)
Fix env panel forward action.
Make env panel update environment when jumping frame to frame. Add separate funcs for sun/moon vectors in various coord systems. Make haze glow only pay attention to sun (i.e. fix sun glow when moon is near horizon in daytime).
Diffstat (limited to 'indra/newview/app_settings')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl6
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl10
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl8
-rw-r--r--indra/newview/app_settings/shaders/class3/deferred/skyF.glsl12
-rw-r--r--indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl1
9 files changed, 49 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index 2234ceeb53..8dda96984e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -43,6 +43,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
#if HAS_SHADOW
uniform sampler2DShadow shadowMap0;
@@ -287,7 +288,10 @@ void main()
vec2 abnormal = encode_normal(norm.xyz);
norm.xyz = decode_normal(abnormal.xy);
- float da = dot(norm.xyz, sun_dir.xyz);
+ float da_sun = dot(norm.xyz, sun_dir.xyz);
+ float da_moon = dot(norm.xyz, moon_dir.xyz);
+
+ float da = max(da_sun, da_moon);
float final_da = da;
final_da = min(final_da, shadow);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index a90e433622..4dc15dbc89 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -98,6 +98,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
VARYING vec3 vary_position;
@@ -388,7 +389,9 @@ void main()
vec3 refnormpersp = normalize(reflect(pos.xyz, norm.xyz));
- float da =dot(norm.xyz, sun_dir.xyz);
+ float da_sun =dot(norm.xyz, sun_dir.xyz);
+ float da_moon =dot(norm.xyz, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
float final_da = da;
final_da = min(final_da, shadow);
@@ -418,7 +421,10 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
+
vec3 dumbshiny = sunlit*shadow*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index fbfd43a4da..a4543c325e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -56,6 +56,7 @@ uniform mat3 env_mat;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -106,7 +107,9 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
- float da = dot(norm.xyz, sun_dir.xyz);
+ float da_sun = dot(norm.xyz, sun_dir.xyz);
+ float da_moon = dot(norm.xyz, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
float final_da = max(0.0,da);
final_da = min(final_da, 1.0f);
@@ -148,7 +151,10 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
+
vec3 dumbshiny = sunlit*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
index a7c28a1ac3..68ce2843d0 100644
--- a/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterFogF.glsl
@@ -25,7 +25,6 @@
-uniform vec4 lightnorm;
uniform vec4 waterPlane;
uniform vec4 waterFogColor;
uniform float waterFogDensity;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 9f56bff4c2..5046ede00d 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -49,7 +49,6 @@ uniform vec4 morphFactor;
uniform vec3 camPosLocal;
//uniform vec4 camPosWorld;
uniform vec4 gamma;
-uniform vec4 lightnorm;
uniform vec4 sunlight_color;
uniform vec4 ambient;
uniform vec4 blue_horizon;
@@ -68,6 +67,7 @@ uniform vec4 shadow_clip;
uniform mat3 ssao_effect_mat;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
VARYING vec2 vary_fragcoord;
uniform mat4 inv_proj;
@@ -117,7 +117,9 @@ void main()
float envIntensity = norm.z;
norm.xyz = decode_normal(norm.xy); // unpack norm
- float da = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ float da_sun = max(dot(norm.xyz, sun_dir.xyz), 0.0);
+ float da_moon = max(dot(norm.xyz, moon_dir.xyz), 0.0);
+ float da = max(da_sun, da_moon);
float light_gamma = 1.0/1.3;
da = pow(da, light_gamma);
@@ -168,7 +170,9 @@ void main()
// the old infinite-sky shiny reflection
//
- float sa = dot(refnormpersp, sun_dir.xyz);
+ float sa_sun = dot(refnormpersp, sun_dir.xyz);
+ float sa_moon = dot(refnormpersp, moon_dir.xyz);
+ float sa = max(sa_sun, sa_moon);
vec3 dumbshiny = sunlit*scol_ambocc.r*(texture2D(lightFunc, vec2(sa, spec.a)).r);
// add the two types of shiny together
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
index aa5e99a2f7..11ccdf638c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
@@ -59,6 +59,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 proj_shadow_res;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform vec2 shadow_res;
uniform float shadow_bias;
@@ -139,10 +140,14 @@ void main()
}*/
float shadow = 0.0;
- float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ float da_sun = dot(norm, sun_dir.xyz);
+ float da_moon = dot(norm, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
+
+ float dp_directional_light = max(0.0, da);
vec3 shadow_pos = pos.xyz;
- vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
+ vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
index 58f3f2f91e..4fccb1d33c 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/sunLightSSAOF.glsl
@@ -59,6 +59,7 @@ uniform mat4 inv_proj;
uniform vec2 screen_res;
uniform vec2 proj_shadow_res;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform vec2 shadow_res;
@@ -200,10 +201,13 @@ void main()
}*/
float shadow = 0.0;
- float dp_directional_light = max(0.0, dot(norm, sun_dir.xyz));
+ float da_sun = dot(norm, sun_dir.xyz);
+ float da_moon = dot(norm, moon_dir.xyz);
+ float da = max(da_sun, da_moon);
+ float dp_directional_light = max(0.0, da);
vec3 shadow_pos = pos.xyz;
- vec3 offset = sun_dir.xyz * (1.0-dp_directional_light);
+ vec3 offset = ((da_sun > da_moon) ? sun_dir.xyz : moon_dir.xyz) * (1.0-dp_directional_light);
vec4 spos = vec4(shadow_pos+offset*shadow_offset, 1.0);
diff --git a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
index a439aa64d7..0fb990611e 100644
--- a/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
+++ b/indra/newview/app_settings/shaders/class3/deferred/skyF.glsl
@@ -34,6 +34,7 @@ in vec3 view_dir;
uniform vec3 cameraPosLocal;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform float sun_size;
uniform sampler2D transmittance_texture;
@@ -42,9 +43,9 @@ uniform sampler3D single_mie_scattering_texture;
uniform sampler2D irradiance_texture;
vec3 GetSolarLuminance();
-vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 sun_dir, out vec3 transmittance);
-vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 sun_dir, out vec3 transmittance);
-vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 sun_dir, out vec3 sky_irradiance);
+vec3 GetSkyLuminance(vec3 camPos, vec3 view_dir, float shadow_length, vec3 dir, out vec3 transmittance);
+vec3 GetSkyLuminanceToPoint(vec3 camPos, vec3 pos, float shadow_length, vec3 dir, out vec3 transmittance);
+vec3 GetSunAndSkyIlluminance(vec3 pos, vec3 norm, vec3 dir, out vec3 sky_irradiance);
void main()
{
@@ -55,8 +56,9 @@ void main()
vec3 camPos = cameraPosLocal + vec3(0, 0, 6360.0f);
vec3 transmittance;
vec3 sky_illum;
- vec3 radiance = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance);
- vec3 radiance2 = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum);
+
+ vec3 radiance_sun = GetSkyLuminance(camPos, view_direction, 0.0f, sun_direction, transmittance);
+ vec3 radiance2_sun = GetSunAndSkyIlluminance(camPos, view_direction, sun_direction, sky_illum);
radiance *= transmittance;
diff --git a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
index fed3edf7de..bdb54a1d63 100644
--- a/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
+++ b/indra/newview/app_settings/shaders/class3/windlight/advancedAtmoF.glsl
@@ -33,6 +33,7 @@ in vec3 view_dir;
uniform vec3 cameraPosLocal;
uniform vec3 sun_dir;
+uniform vec3 moon_dir;
uniform float sun_size;
uniform sampler2D transmittance_texture;