diff options
author | Armin Weatherwax | 2010-09-07 13:41:02 +0200 |
---|---|---|
committer | Armin Weatherwax | 2010-09-23 15:42:40 +0200 |
commit | 087e15e89930d51c3964329befb273ae3b2d330d (patch) | |
tree | 684c49a772b0097ed88a25660e1fd3dd10b264cc /linden/indra/newview/app_settings/shaders/class1/effects | |
parent | Robin Cornelius: fixes for building plugins on Linux 64bit (diff) | |
download | meta-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')
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 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float brightness; | ||
10 | uniform float contrast; | ||
11 | uniform vec3 contrastBase; | ||
12 | uniform float saturation; | ||
13 | uniform vec3 lumWeights; | ||
14 | |||
15 | const float gamma = 2.0; | ||
16 | |||
17 | void 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 | |||
8 | void 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 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform sampler2D NoiseTexture; | ||
10 | uniform float brightMult; | ||
11 | uniform float noiseStrength; | ||
12 | |||
13 | float 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 | |||
20 | void 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 | } | ||