summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl
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/shaders/class2/deferred/sunLightF.glsl
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/shaders/class2/deferred/sunLightF.glsl')
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/sunLightF.glsl9
1 files changed, 7 insertions, 2 deletions
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);