summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1
diff options
context:
space:
mode:
authorGraham Linden <graham@lindenlab.com>2013-09-25 13:16:31 -0700
committerGraham Linden <graham@lindenlab.com>2013-09-25 13:16:31 -0700
commitd31010512154ef1806281552f639e492bdde7fcd (patch)
tree951ba65ec940f5bec236855490380cd43e74ebe7 /indra/newview/app_settings/shaders/class1
parent089081dc802a8efb41d3eda7b2eec6f9637f1c4b (diff)
parent571920c7b4fb8966088e769c630cda3c149c4e39 (diff)
Merge recent viewer-bear fixes that missed the boat
Diffstat (limited to 'indra/newview/app_settings/shaders/class1')
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl10
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl9
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl6
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/deferred/waterF.glsl1
-rwxr-xr-xindra/newview/app_settings/shaders/class1/environment/underWaterF.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/environment/waterF.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl2
-rwxr-xr-xindra/newview/app_settings/shaders/class1/objects/previewV.glsl4
9 files changed, 20 insertions, 18 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
index 145cf524d4..c8ddefac26 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/avatarAlphaNoColorV.glsl
@@ -71,18 +71,18 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
vec3 lv = lp.xyz-v;
//get distance
- float d = length(lv);
+ float d = dot(lv,lv);
float da = 0.0;
- //if (d > 0.0 && la > 0.0 && fa > 0.0)
+ if (d > 0.0 && la > 0.0 && fa > 0.0)
{
//normalize light vector
- lv /= d;
+ lv = normalize(lv);
//distance attenuation
- float dist = d*la;
- da = clamp(1.0-(dist-1.0+fa)/fa, 0.0, 1.0);
+ float dist2 = d/la;
+ da = clamp(1.0-(dist2-1.0*(1.0-fa))/fa, 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 2e5a2c273e..0e6ab80d4d 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -311,14 +311,11 @@ void main()
vec3 pfinal = pos + ref * dot(pdelta, proj_n)/ds;
vec4 stc = (proj_mat * vec4(pfinal.xyz, 1.0));
-
+ stc /= stc.w;
if (stc.z > 0.0)
{
- stc.xy /= stc.w;
-
- float fatten = clamp(envIntensity*envIntensity+envIntensity*0.5, 0.25, 1.0);
+ float fatten = clamp(envIntensity*envIntensity+envIntensity*0.25, 0.25, 1.0);
- //stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
stc.xy = (stc.xy - vec2(0.5)) * fatten + vec2(0.5);
if (stc.x < 1.0 &&
@@ -326,7 +323,7 @@ void main()
stc.x > 0.0 &&
stc.y > 0.0)
{
- col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod-envIntensity*proj_lod).rgb*spec.rgb;
+ col += color.rgb*texture2DLodSpecular(projectionMap, stc.xy, proj_lod).rgb*spec.rgb;
}
}
}
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 73b9767a71..106d48bd71 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -35,7 +35,7 @@ uniform sampler2DRect diffuseRect;
uniform sampler2DRect specularRect;
uniform sampler2DRect normalMap;
uniform samplerCube environmentMap;
-//uniform sampler2D noiseMap;
+uniform sampler2D noiseMap;
uniform sampler2D lightFunc;
uniform sampler2DRect depthMap;
@@ -112,7 +112,7 @@ void main()
lv = normalize(lv);
da = dot(norm, lv);
- //float noise = texture2D(noiseMap, frag.xy/128.0).b;
+ float noise = texture2D(noiseMap, frag.xy/128.0).b;
vec3 col = texture2DRect(diffuseRect, frag.xy).rgb;
float fa = falloff+1.0;
@@ -120,7 +120,7 @@ void main()
dist_atten *= dist_atten;
dist_atten *= 2.0;
- float lit = da * dist_atten;
+ float lit = da * dist_atten * noise;
col = color.rgb*lit*col;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
index aeef09cf5f..a5625fbc16 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightV.glsl
@@ -37,7 +37,7 @@ VARYING vec3 trans_center;
void main()
{
//transform vertex
- vec3 p = position*1.f/size+center;
+ vec3 p = position*size+center;
vec4 pos = modelview_projection_matrix * vec4(p.xyz, 1.0);
vary_fragcoord = pos;
trans_center = (modelview_matrix*vec4(center.xyz, 1.0)).xyz;
diff --git a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
index e7a3bb2001..1c3ad49a21 100755
--- a/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/waterF.glsl
@@ -58,6 +58,7 @@ uniform vec3 normScale;
uniform float fresnelScale;
uniform float fresnelOffset;
uniform float blurMultiplier;
+uniform vec2 screen_res;
uniform mat4 norm_mat; //region space to screen space
//bigWave is (refCoord.w, view.w);
diff --git a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
index 485e48537c..0d8dab0a41 100755
--- a/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/underWaterF.glsl
@@ -43,11 +43,13 @@ uniform vec2 fbScale;
uniform float refScale;
uniform float znear;
uniform float zfar;
+uniform float kd;
uniform vec4 waterPlane;
uniform vec3 eyeVec;
uniform vec4 waterFogColor;
uniform float waterFogDensity;
uniform float waterFogKS;
+uniform vec2 screenRes;
//bigWave is (refCoord.w, view.w);
VARYING vec4 refCoord;
diff --git a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
index 1fd7bdaa5c..79bffab745 100755
--- a/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
+++ b/indra/newview/app_settings/shaders/class1/environment/waterF.glsl
@@ -42,6 +42,8 @@ uniform vec3 lightDir;
uniform vec3 specular;
uniform float lightExp;
uniform float refScale;
+uniform float kd;
+uniform vec2 screenRes;
uniform vec3 normScale;
uniform float fresnelScale;
uniform float fresnelOffset;
diff --git a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
index dc0b989e34..a9288b3df6 100755
--- a/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
+++ b/indra/newview/app_settings/shaders/class1/lighting/lightFuncV.glsl
@@ -45,7 +45,7 @@ float calcPointLightOrSpotLight(vec3 v, vec3 n, vec4 lp, vec3 ln, float la, floa
lv *= 1.0/d;
//distance attenuation
- float da = clamp(1.0/(1.f/la * d), 0.0, 1.0);
+ float da = clamp(1.0/(la * d), 0.0, 1.0);
// spotlight coefficient.
float spot = max(dot(-ln, lv), is_pointlight);
diff --git a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
index c325a236d7..7f3f84398b 100755
--- a/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/previewV.glsl
@@ -91,8 +91,8 @@ void main()
// Collect normal lights (need to be divided by two, as we later multiply by 2)
col.rgb += light_diffuse[1].rgb * calcDirectionalLight(norm, light_position[1].xyz);
- col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], 1.f/light_attenuation[2].x, light_attenuation[2].z);
- col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], 1.f/light_attenuation[3].x, light_attenuation[3].z);
+ col.rgb += light_diffuse[2].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[2], light_direction[2], light_attenuation[2].x, light_attenuation[2].z);
+ col.rgb += light_diffuse[3].rgb*calcPointLightOrSpotLight(pos.xyz, norm, light_position[3], light_direction[3], light_attenuation[3].x, light_attenuation[3].z);
vertex_color = col*color;
}