summaryrefslogtreecommitdiff
path: root/indra/newview/app_settings/shaders/class1/effects
diff options
context:
space:
mode:
authorBrad Kittenbrink <brad@lindenlab.com>2008-02-27 18:58:14 +0000
committerBrad Kittenbrink <brad@lindenlab.com>2008-02-27 18:58:14 +0000
commit6d52efe452aa8469e0343da1c7d108f3f52ab651 (patch)
treea87be48e9840d7fc1f7ee514d7c7f994e71fdb3c /indra/newview/app_settings/shaders/class1/effects
parent6027ad2630b8650cabcf00628ee9b0d25bedd67f (diff)
Merge of windlight into release (QAR-286). This includes all changes in
windlight14 which have passed QA (up through r79932). svn merge -r 80831:80833 svn+ssh://svn.lindenlab.com/svn/linden/branches/merge_windlight14_r80620
Diffstat (limited to 'indra/newview/app_settings/shaders/class1/effects')
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl28
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl14
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowF.glsl31
-rw-r--r--indra/newview/app_settings/shaders/class1/effects/glowV.glsl22
4 files changed, 95 insertions, 0 deletions
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
new file mode 100644
index 0000000000..dbdfe1174c
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl
@@ -0,0 +1,28 @@
+/**
+ * @file glowExtractF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+#extension GL_ARB_texture_rectangle : enable
+
+uniform sampler2DRect diffuseMap;
+uniform float minLuminance;
+uniform float maxExtractAlpha;
+uniform vec3 lumWeights;
+uniform vec3 warmthWeights;
+uniform float warmthAmount;
+
+void main()
+{
+ vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy);
+
+ /// CALCULATING LUMINANCE (Using NTSC lum weights)
+ /// http://en.wikipedia.org/wiki/Luma_%28video%29
+ float lum = smoothstep(minLuminance, 1.0, dot(col.rgb, lumWeights ) );
+ float warmth = smoothstep(minLuminance, 1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) );
+
+ gl_FragColor.rgb = col.rgb;
+ gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha);
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
new file mode 100644
index 0000000000..61dfd2f126
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowExtractV.glsl
@@ -0,0 +1,14 @@
+/**
+ * @file glowExtractV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ gl_TexCoord[0].xy = gl_MultiTexCoord0.xy;
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowF.glsl b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
new file mode 100644
index 0000000000..21c7ad765f
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowF.glsl
@@ -0,0 +1,31 @@
+/**
+ * @file glowF.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform sampler2D diffuseMap;
+uniform float glowStrength;
+
+void main()
+{
+
+ vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
+
+ // ATI compiler falls down on array initialization.
+ float kern[8];
+ kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
+ kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
+
+ col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy);
+ col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy);
+ col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy);
+ col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy);
+ col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw);
+ col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw);
+ col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw);
+ col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw);
+
+ gl_FragColor = vec4(col.rgb * glowStrength, col.a);
+}
diff --git a/indra/newview/app_settings/shaders/class1/effects/glowV.glsl b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
new file mode 100644
index 0000000000..13ce7c7854
--- /dev/null
+++ b/indra/newview/app_settings/shaders/class1/effects/glowV.glsl
@@ -0,0 +1,22 @@
+/**
+ * @file glowV.glsl
+ *
+ * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
+ * $License$
+ */
+
+uniform vec2 glowDelta;
+
+void main()
+{
+ gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
+
+ gl_TexCoord[0].xy = gl_MultiTexCoord0.xy + glowDelta*(-3.5);
+ gl_TexCoord[1].xy = gl_MultiTexCoord0.xy + glowDelta*(-2.5);
+ gl_TexCoord[2].xy = gl_MultiTexCoord0.xy + glowDelta*(-1.5);
+ gl_TexCoord[3].xy = gl_MultiTexCoord0.xy + glowDelta*(-0.5);
+ gl_TexCoord[0].zw = gl_MultiTexCoord0.xy + glowDelta*(0.5);
+ gl_TexCoord[1].zw = gl_MultiTexCoord0.xy + glowDelta*(1.5);
+ gl_TexCoord[2].zw = gl_MultiTexCoord0.xy + glowDelta*(2.5);
+ gl_TexCoord[3].zw = gl_MultiTexCoord0.xy + glowDelta*(3.5);
+}