summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class2/deferred
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2013-06-13 14:33:59 -0500
committerDave Parks <davep@lindenlab.com>2013-06-13 14:33:59 -0500
commitc7479098f5a60de0e14e18d427067338f0f6c6a6 (patch)
treeecf47821cf4b9dbe0f6737c30cbd55e34dd5faab /indra/newview/app_settings/shaders/class2/deferred
parente88910e9de27a6024534b3ba9ceb7f200f02fc64 (diff)
NORSPEC-261 Better blending of environment map.
Diffstat (limited to 'indra/newview/app_settings/shaders/class2/deferred')
-rwxr-xr-xindra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl80
1 files changed, 39 insertions, 41 deletions
diff --git a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
index 520b3bbd47..eb83fab6b5 100755
--- a/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
+++ b/indra/newview/app_settings/shaders/class2/deferred/softenLightF.glsl
@@ -78,38 +78,38 @@ vec3 vary_AtmosAttenuation;
uniform mat4 inv_proj;
uniform vec2 screen_res;
-#ifdef SINGLE_FP_ONLY
-vec2 encode_normal(vec3 n)
-{
- vec2 sn;
- sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
- return sn;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec3 n;
- n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
- n.z = sqrt(1.0f - dot(n.xy,n.xy));
- return n;
-}
-#else
-vec2 encode_normal(vec3 n)
-{
- float f = sqrt(8 * n.z + 8);
- return n.xy / f + 0.5;
-}
-
-vec3 decode_normal (vec2 enc)
-{
- vec2 fenc = enc*4-2;
- float f = dot(fenc,fenc);
- float g = sqrt(1-f/4);
- vec3 n;
- n.xy = fenc*g;
- n.z = 1-f/2;
- return n;
-}
+#ifdef SINGLE_FP_ONLY
+vec2 encode_normal(vec3 n)
+{
+ vec2 sn;
+ sn.xy = (n.xy * vec2(0.5f,0.5f)) + vec2(0.5f,0.5f);
+ return sn;
+}
+
+vec3 decode_normal (vec2 enc)
+{
+ vec3 n;
+ n.xy = (enc.xy * vec2(2.0f,2.0f)) - vec2(1.0f,1.0f);
+ n.z = sqrt(1.0f - dot(n.xy,n.xy));
+ return n;
+}
+#else
+vec2 encode_normal(vec3 n)
+{
+ float f = sqrt(8 * n.z + 8);
+ return n.xy / f + 0.5;
+}
+
+vec3 decode_normal (vec2 enc)
+{
+ vec2 fenc = enc*4-2;
+ float f = dot(fenc,fenc);
+ float g = sqrt(1-f/4);
+ vec3 n;
+ n.xy = fenc*g;
+ n.z = 1-f/2;
+ return n;
+}
#endif
vec4 getPosition_d(vec2 pos_screen, float depth)
@@ -374,23 +374,21 @@ void main()
}
- col = mix(col.rgb, pow(diffuse.rgb, vec3(1.0/2.2)), diffuse.a);
-
-
+ col = mix(col.rgb, diffuse.rgb, diffuse.a);
+
if (envIntensity > 0.0)
{ //add environmentmap
vec3 env_vec = env_mat * refnormpersp;
- float exponent = mix(2.2, 1.0, diffuse.a);
- vec3 refcol = pow(textureCube(environmentMap, env_vec).rgb, vec3(exponent))*exponent;
+
+ vec3 refcol = textureCube(environmentMap, env_vec).rgb;
- col = mix(col.rgb, refcol,
+ col = mix(pow(col.rgb, vec3(1.0/2.2)), refcol,
envIntensity);
- }
+ col = pow(col, vec3(2.2));
- float exponent = mix(1.0, 2.2, diffuse.a);
- col = pow(col, vec3(exponent));
+ }
if (norm.w < 0.5)
{