aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/app_settings/shaders/class1/effects
diff options
context:
space:
mode:
authorArmin Weatherwax2010-09-07 13:41:02 +0200
committerArmin Weatherwax2010-09-23 15:42:40 +0200
commit087e15e89930d51c3964329befb273ae3b2d330d (patch)
tree684c49a772b0097ed88a25660e1fd3dd10b264cc /linden/indra/newview/app_settings/shaders/class1/effects
parentRobin Cornelius: fixes for building plugins on Linux 64bit (diff)
downloadmeta-impy-087e15e89930d51c3964329befb273ae3b2d330d.zip
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.gz
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.bz2
meta-impy-087e15e89930d51c3964329befb273ae3b2d330d.tar.xz
port of LL renderpipeline/Kirstens S19 pipeline for bridging to Viewer 2 texture system
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class1/effects')
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl31
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl14
-rw-r--r--linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl42
3 files changed, 87 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
new file mode 100644
index 0000000..623ef7a
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class1/effects/colorFilterF.glsl
@@ -0,0 +1,31 @@
1/**
2 * @file colorFilterF.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8uniform sampler2DRect RenderTexture;
9uniform float brightness;
10uniform float contrast;
11uniform vec3 contrastBase;
12uniform float saturation;
13uniform vec3 lumWeights;
14
15const float gamma = 2.0;
16
17void main(void)
18{
19 vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
20
21 /// Modulate brightness
22 color *= brightness;
23
24 /// Modulate contrast
25 color = mix(contrastBase, color, contrast);
26
27 /// Modulate saturation
28 color = mix(vec3(dot(color, lumWeights)), color, saturation);
29
30 gl_FragColor = vec4(color, 1.0);
31}
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl
new file mode 100644
index 0000000..29c2a09
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class1/effects/drawQuadV.glsl
@@ -0,0 +1,14 @@
1/**
2 * @file drawQuadV.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8void main(void)
9{
10 //transform vertex
11 gl_Position = ftransform();
12 gl_TexCoord[0] = gl_MultiTexCoord0;
13 gl_TexCoord[1] = gl_MultiTexCoord1;
14}
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
new file mode 100644
index 0000000..271d5cf
--- /dev/null
+++ b/linden/indra/newview/app_settings/shaders/class1/effects/nightVisionF.glsl
@@ -0,0 +1,42 @@
1/**
2 * @file nightVisionF.glsl
3 *
4 * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
5 * $License$
6 */
7
8uniform sampler2DRect RenderTexture;
9uniform sampler2D NoiseTexture;
10uniform float brightMult;
11uniform float noiseStrength;
12
13float luminance(vec3 color)
14{
15 /// CALCULATING LUMINANCE (Using NTSC lum weights)
16 /// http://en.wikipedia.org/wiki/Luma_%28video%29
17 return dot(color, vec3(0.299, 0.587, 0.114));
18}
19
20void main(void)
21{
22 /// Get scene color
23 vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
24
25 /// Extract luminance and scale up by night vision brightness
26 float lum = luminance(color) * brightMult;
27
28 /// Convert into night vision color space
29 /// Newer NVG colors (crisper and more saturated)
30 vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12);
31
32 /// Add noise
33 float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r;
34 noiseValue = (noiseValue - 0.5) * noiseStrength;
35
36 /// Older NVG colors (more muted)
37 // vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11);
38
39 outColor += noiseValue;
40
41 gl_FragColor = vec4(outColor, 1.0);
42}