summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/deferred
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/deferred')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl21
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl13
2 files changed, 22 insertions, 12 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index c8f4d7c570..251e60c59e 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -202,7 +202,8 @@ void main()
#endif
#if (DIFFUSE_ALPHA_MODE == DIFFUSE_ALPHA_MODE_BLEND)
- vec3 gamma_diff = linear_to_srgb(diffcol.rgb);
+ vec3 gamma_diff = diffcol.rgb;
+ diffcol.rgb = srgb_to_linear(diffcol.rgb);
#endif
#if HAS_SPECULAR_MAP
@@ -280,20 +281,17 @@ void main()
final_da = min(final_da, 1.0f);
final_da = pow(final_da, display_gamma);
- col.rgb = (col * 0.5) + amblit;
+ col.rgb = amblit;
float ambient = min(abs(final_da), 1.0);
ambient *= 0.5;
ambient *= ambient;
ambient = (1.0-ambient);
- col.rgb *= ambient;
-
- col.rgb = col.rgb + (final_da * sunlit);
-
+ col.rgb *= min(ambient, max(shadow,0.3));
+ col.rgb += (final_da * sunlit);
col.rgb *= gamma_diff.rgb;
-
float glare = 0.0;
if (spec.a > 0.0) // specular reflection
@@ -315,6 +313,7 @@ void main()
col += spec_contrib;
}
+vec3 post_spec = col.rgb;
col = mix(col.rgb, diffcol.rgb, diffuse.a);
@@ -337,6 +336,8 @@ void main()
col = atmosFragLighting(col, additive, atten);
col = scaleSoftClipFrag(col);
+vec3 post_atmo= col.rgb;
+
vec3 npos = normalize(-pos.xyz);
vec3 light = vec3(0,0,0);
@@ -353,18 +354,24 @@ void main()
col.rgb += light.rgb;
+vec3 post_lighting = col.rgb;
+
glare = min(glare, 1.0);
float al = max(diffcol.a,glare)*vertex_color.a;
//convert to gamma space for display on screen
col.rgb = linear_to_srgb(col.rgb);
+vec3 post_srgb = col.rgb;
+
#ifdef WATER_FOG
vec4 temp = applyWaterFogView(pos, vec4(col.rgb, al));
col.rgb = temp.rgb;
al = temp.a;
#endif
+//col.rgb = post_lighting;
+
frag_color.rgb = col.rgb;
frag_color.a = al;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 5cc24475e3..ad96c84de8 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -49,8 +49,8 @@ uniform int sun_up_factor;
float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
stc.xyz /= stc.w;
- stc.z += shadow_bias * bias_mul* 2.0;
- stc.x = floor(stc.x*shadow_res.x + fract(stc.y*pos_screen.y*pos_screen.x))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
+ stc.z += shadow_bias * bias_mul * 2.0;
+ stc.x = floor(stc.x*shadow_res.x + fract(stc.y*shadow_res.y))/shadow_res.x; // add some chaotic jitter to X sample pos according to Y to disguise the snapping going on here
float cs = shadow2D(shadowMap, stc.xyz).x;
float shadow = cs * 4.0;
@@ -90,7 +90,9 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
dp_directional_light = clamp(dp_directional_light, 0.0, 1.0);
vec3 shadow_pos = pos.xyz;
- vec3 offset = abs(light_dir.xyz) * (1.0 - dp_directional_light* 0.8);
+
+ vec3 offset = light_dir.xyz * (1.0 - dp_directional_light);
+
shadow_pos += offset * shadow_offset;
vec4 spos = vec4(shadow_pos.xyz, 1.0);
@@ -109,7 +111,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap3, norm, lpos, 4.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap3, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
shadow += max((pos.z+shadow_clip.z)/(shadow_clip.z-shadow_clip.w)*2.0-1.0, 0.0);
}
@@ -121,7 +123,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.y, 0.0)/transition_domain.y;
w -= max(near_split.z-spos.z, 0.0)/transition_domain.z;
- shadow += pcfShadow(shadowMap2, norm, lpos, 2.0, pos_screen, light_dir)*w;
+ shadow += pcfShadow(shadowMap2, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -153,6 +155,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
{
return 1.0f; // lit beyond the far split...
}
+ shadow = min(dp_directional_light,shadow);
return shadow;
}