summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/materialF.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl19
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl7
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/waterF.glsl9
-rw-r--r--indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl5
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl6
-rw-r--r--indra/newview/pipeline.cpp4
8 files changed, 37 insertions, 21 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
index ab7f779a39..e8400ba66d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/alphaF.glsl
@@ -83,6 +83,8 @@ void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, o
float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen);
#endif
+float getAmbientClamp();
+
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 diffuse, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, float ambiance)
{
//get light vector
@@ -209,7 +211,7 @@ void main()
float ambient = da;
ambient *= 0.5;
ambient *= ambient;
- ambient = max(0.66, ambient); // keeps shadows dark
+ ambient = max(getAmbientClamp(), ambient); // keeps shadows dark
ambient = 1.0 - ambient;
vec3 sun_contrib = min(final_da, shadow) * sunlit;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
index 0819f1b292..f1dbf4af46 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/materialF.glsl
@@ -83,6 +83,8 @@ uniform vec3 light_direction[8];
uniform vec4 light_attenuation[8];
uniform vec3 light_diffuse[8];
+float getAmbientClamp();
+
vec3 calcPointLightOrSpotLight(vec3 light_col, vec3 npos, vec3 diffuse, vec4 spec, vec3 v, vec3 n, vec4 lp, vec3 ln, float la, float fa, float is_pointlight, inout float glare, float ambiance)
{
//get light vector
@@ -305,7 +307,7 @@ void main()
float ambient = da;
ambient *= 0.5;
ambient *= ambient;
- ambient = max(0.66, ambient);
+ ambient = max(getAmbientClamp(), ambient);
ambient = 1.0 - ambient;
vec3 sun_contrib = min(final_da, shadow) * sunlit;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
index 84032f7ff7..c2cb0eb8c3 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/shadowUtil.glsl
@@ -48,15 +48,17 @@ uniform int sun_up_factor;
float pcfShadow(sampler2DShadow shadowMap, vec3 norm, vec4 stc, float bias_mul, vec2 pos_screen, vec3 light_dir)
{
+ float offset = shadow_bias * bias_mul;
stc.xyz /= stc.w;
- stc.z += shadow_bias * bias_mul * 2.0;
+ stc.z += offset * 4.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;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(2.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(1.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.0/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
- shadow += shadow2D(shadowMap, stc.xyz+vec3(-2.0/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
+ stc.z += offset * 2.0;
+ shadow += shadow2D(shadowMap, stc.xyz+vec3( 1.5/shadow_res.x, 0.5/shadow_res.y, 0.0)).x;
+ shadow += shadow2D(shadowMap, stc.xyz+vec3( 0.5/shadow_res.x, -1.5/shadow_res.y, 0.0)).x;
+ shadow += shadow2D(shadowMap, stc.xyz+vec3(-1.5/shadow_res.x, -0.5/shadow_res.y, 0.0)).x;
+ shadow += shadow2D(shadowMap, stc.xyz+vec3(-0.5/shadow_res.x, 1.5/shadow_res.y, 0.0)).x;
return clamp(shadow * 0.125, 0.0, 1.0);
}
@@ -91,7 +93,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
vec3 offset = light_dir.xyz * (1.0 - dp_directional_light);
- shadow_pos += offset * shadow_offset;
+ shadow_pos += offset * shadow_offset * 2.0;
vec4 spos = vec4(shadow_pos.xyz, 1.0);
@@ -109,6 +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;
+ w = clamp(w, 0.0, 1.0);
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,6 +124,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;
+ w = clamp(w, 0.25, 1.0);
shadow += pcfShadow(shadowMap2, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -132,6 +136,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(spos.z-far_split.x, 0.0)/transition_domain.x;
w -= max(near_split.y-spos.z, 0.0)/transition_domain.y;
+ w = clamp(w, 0.5, 1.0);
shadow += pcfShadow(shadowMap1, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
@@ -142,7 +147,7 @@ float sampleDirectionalShadow(vec3 pos, vec3 norm, vec2 pos_screen)
float w = 1.0;
w -= max(near_split.x-spos.z, 0.0)/transition_domain.x;
-
+ w = clamp(w, 0.75, 1.0);
shadow += pcfShadow(shadowMap0, norm, lpos, 1.0, pos_screen, light_dir)*w;
weight += w;
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
index 8d126859c3..68deedd0d0 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/softenLightF.glsl
@@ -70,6 +70,7 @@ vec4 applyWaterFogView(vec3 pos, vec4 color);
vec3 getNorm(vec2 pos_screen);
vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
+float getAmbientClamp();
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
vec3 scaleSoftClipFrag(vec3 l);
@@ -93,7 +94,7 @@ void main()
float final_da = da;
final_da = clamp(final_da, 0.0, 1.0);
- final_da = pow(final_da, light_gamma);
+ //final_da = pow(final_da, light_gamma);
vec4 diffuse = texture2DRect(diffuseRect, tc);
@@ -111,7 +112,7 @@ void main()
float ambient = da;
ambient *= 0.5;
ambient *= ambient;
- ambient = max(0.66, ambient);
+ ambient = max(getAmbientClamp(), ambient);
ambient = 1.0 - ambient;
vec3 sun_contrib = final_da * sunlit;
@@ -177,7 +178,7 @@ vec3 post_diffuse = col.rgb;
bloom = fogged.a;
#endif
-//col.rgb = post_diffuse;
+//col.rgb = vec3(final_da);
}
frag_color.rgb = col.rgb;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index e0af521511..e72b36f28a 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -144,13 +144,14 @@ void main()
refcol = mix(baseCol*df2, refcol, dweight);
//figure out distortion vector (ripply)
- vec2 distort2 = distort+wavef.xy*refScale * 0.33/max(dmod*df1, 1.0);
+ vec2 distort2 = distort+wavef.xy*(refScale * 0.01)/max(dmod*df1, 1.0);
vec4 fb = texture2D(screenTex, distort2);
+
//mix with reflection
- // Note we actually want to use just df1, but multiplying by 0.999999 gets around an nvidia compiler bug
- color.rgb = mix(fb.rgb, refcol.rgb, df1 * 0.99999);
-
+ color.rgb = fb.rgb;
+ color.rgb += refcol.rgb * df1;
+
vec4 pos = vary_position;
vec3 screenspacewavef = normalize((norm_mat*vec4(wavef, 1.0)).xyz);
diff --git a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
index 07190d081e..09fb3e4c8a 100644
--- a/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
+++ b/indra/newview/app_settings/shaders/class1/windlight/atmosphericsFuncs.glsl
@@ -42,6 +42,11 @@ uniform mat3 ssao_effect_mat;
uniform int no_atmo;
uniform float sun_moon_glow_factor;
+float getAmbientClamp()
+{
+ return 0.88f;
+}
+
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten) {
vec3 P = inPositionEye;
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index a1d1287825..dd70790fc3 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -71,7 +71,7 @@ vec3 atmosFragLighting(vec3 l, vec3 additive, vec3 atten);
vec3 scaleSoftClipFrag(vec3 l);
void calcAtmosphericVars(vec3 inPositionEye, float ambFactor, out vec3 sunlit, out vec3 amblit, out vec3 additive, out vec3 atten);
-
+float getAmbientClamp();
vec3 atmosTransportFrag(vec3 light, vec3 additive, vec3 atten);
vec4 getPositionWithDepth(vec2 pos_screen, float depth);
@@ -106,7 +106,7 @@ void main()
float final_da = da;
final_da = clamp(final_da, 0.0, 1.0);
- final_da = pow(final_da, light_gamma);
+ //final_da = pow(final_da, light_gamma);
vec4 spec = texture2DRect(specularRect, vary_fragcoord.xy);
vec3 col;
@@ -124,7 +124,7 @@ void main()
float ambient = da;
ambient *= 0.5;
ambient *= ambient;
- ambient = max(0.66, ambient);
+ ambient = max(getAmbientClamp(), ambient);
ambient = 1.0 - ambient;
vec3 sun_contrib = scol * final_da * sunlit;
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 27b280a4a8..b7c6d7817a 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -8238,7 +8238,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
{
stop_glerror();
gGL.getTexUnit(channel)->bind(getShadowTarget(i), TRUE);
- gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+ gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
stop_glerror();
@@ -8260,7 +8260,7 @@ void LLPipeline::bindDeferredShader(LLGLSLShader& shader, LLRenderTarget* light_
if (shadow_target)
{
gGL.getTexUnit(channel)->bind(shadow_target, TRUE);
- gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_BILINEAR);
+ gGL.getTexUnit(channel)->setTextureFilteringOption(LLTexUnit::TFO_ANISOTROPIC);
gGL.getTexUnit(channel)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
stop_glerror();