summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-05-01 16:42:07 -0500
committerDave Parks <davep@lindenlab.com>2013-05-01 16:42:07 -0500
commit0938ce04f7d12439740285b61db3dd0bdadebb4f (patch)
treebc016afff8ff7bd97d9c043ac89338fa5c88f695 /indra
parentb06ec66a5d11628905da256e084d0036f39ba529 (diff)
Fix up specular highlights and gamma correction for projectors.
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl2
-rw-r--r--indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl1
-rw-r--r--indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl4
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl16
-rw-r--r--indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl1
7 files changed, 30 insertions, 9 deletions
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
index db42a54e42..338532e71d 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiPointLightF.glsl
@@ -137,6 +137,7 @@ void main()
if (spec.a > 0.0)
{
+ lit = min(da*6.0, 1.0) * dist_atten;
//vec3 ref = dot(pos+lv, norm);
vec3 h = normalize(lv+npos);
float nh = dot(norm, h);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
index 893a92299a..6675bfde69 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/multiSpotLightF.glsl
@@ -78,9 +78,15 @@ vec3 decode_normal (vec2 enc)
return n;
}
+vec4 correctWithGamma(vec4 col)
+{
+ return vec4(pow(col.rgb, vec3(2.2)), col.a);
+}
+
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
+ ret = correctWithGamma(ret);
vec2 dist = tc-vec2(0.5);
@@ -96,7 +102,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
-
+ ret = correctWithGamma(ret);
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -113,7 +120,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
-
+ ret = correctWithGamma(ret);
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
@@ -226,6 +234,8 @@ void main()
if (spec.a > 0.0)
{
+ dlit *= min(da*6.0, 1.0) * dist_atten;
+
vec3 npos = -normalize(pos);
//vec3 ref = dot(pos+lv, norm);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
index 36406cbf57..69cdb2ce71 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/pointLightF.glsl
@@ -119,6 +119,8 @@ void main()
vec4 spec = texture2DRect(specularRect, frag.xy);
if (spec.a > 0.0)
{
+ lit = min(da*6.0, 1.0) * dist_atten;
+
vec3 npos = -normalize(pos);
vec3 h = normalize(lv+npos);
float nh = dot(norm, h);
diff --git a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
index b29f676ecc..c918a42c73 100644
--- a/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class1/deferred/spotLightF.glsl
@@ -234,6 +234,7 @@ void main()
if (spec.a > 0.0)
{
+ dlit *= min(da*6.0, 1.0) * dist_atten;
vec3 npos = -normalize(pos);
//vec3 ref = dot(pos+lv, norm);
diff --git a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
index 8494ffba52..3dab224258 100644
--- a/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
+++ b/indra/newview/app_settings/shaders/class1/objects/emissiveSkinnedV.glsl
@@ -50,9 +50,5 @@ void main()
calcAtmospherics(pos.xyz);
- vertex_color = emissive;
-
gl_Position = projection_matrix*vec4(pos, 1.0);
-
-
}
diff --git a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
index 9ddbb6da6a..a6b0f7e7c1 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/multiSpotLightF.glsl
@@ -79,10 +79,17 @@ vec3 decode_normal (vec2 enc)
return n;
}
+vec4 correctWithGamma(vec4 col)
+{
+ return vec4(pow(col.rgb, vec3(2.2)), col.a);
+}
+
+
vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
-
+ ret = correctWithGamma(ret);
+
vec2 dist = tc-vec2(0.5);
float det = max(1.0-lod/(proj_lod*0.5), 0.0);
@@ -97,7 +104,8 @@ vec4 texture2DLodSpecular(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
-
+ ret = correctWithGamma(ret);
+
vec2 dist = vec2(0.5) - abs(tc-vec2(0.5));
float det = min(lod/(proj_lod*0.5), 1.0);
@@ -114,7 +122,8 @@ vec4 texture2DLodDiffuse(sampler2D projectionMap, vec2 tc, float lod)
vec4 texture2DLodAmbient(sampler2D projectionMap, vec2 tc, float lod)
{
vec4 ret = texture2DLod(projectionMap, tc, lod);
-
+ ret = correctWithGamma(ret);
+
vec2 dist = tc-vec2(0.5);
float d = dot(dist,dist);
@@ -243,6 +252,7 @@ void main()
if (spec.a > 0.0)
{
vec3 npos = -normalize(pos);
+ dlit *= min(da*6.0, 1.0) * dist_atten;
//vec3 ref = dot(pos+lv, norm);
vec3 h = normalize(lv+npos);
diff --git a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
index aa964fa0a3..91ff1f1e76 100644
--- a/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/spotLightF.glsl
@@ -248,6 +248,7 @@ void main()
if (spec.a > 0.0)
{
+ dlit *= min(da*6.0, 1.0) * dist_atten;
vec3 npos = -normalize(pos);
//vec3 ref = dot(pos+lv, norm);