diff options
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class3/effects')
7 files changed, 189 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl new file mode 100644 index 0000000..9443320 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/effects/blurF.glsl | |||
@@ -0,0 +1,31 @@ | |||
1 | /** | ||
2 | * @file blurf.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float bloomStrength; | ||
10 | |||
11 | varying vec4 gl_TexCoord[gl_MaxTextureCoords]; | ||
12 | void main(void) | ||
13 | { | ||
14 | float blurWeights[7]; | ||
15 | blurWeights[0] = 0.05; | ||
16 | blurWeights[1] = 0.1; | ||
17 | blurWeights[2] = 0.2; | ||
18 | blurWeights[3] = 0.3; | ||
19 | blurWeights[4] = 0.2; | ||
20 | blurWeights[5] = 0.1; | ||
21 | blurWeights[6] = 0.05; | ||
22 | |||
23 | vec3 color = vec3(0,0,0); | ||
24 | for (int i = 0; i < 7; i++){ | ||
25 | color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i]; | ||
26 | } | ||
27 | |||
28 | color *= bloomStrength; | ||
29 | |||
30 | gl_FragColor = vec4(color, 1.0); | ||
31 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl new file mode 100644 index 0000000..ba65b16 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/effects/blurV.glsl | |||
@@ -0,0 +1,35 @@ | |||
1 | /** | ||
2 | * @file blurV.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform vec2 texelSize; | ||
9 | uniform vec2 blurDirection; | ||
10 | uniform float blurWidth; | ||
11 | |||
12 | void main(void) | ||
13 | { | ||
14 | // Transform vertex | ||
15 | gl_Position = ftransform(); | ||
16 | |||
17 | vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth); | ||
18 | vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0); | ||
19 | |||
20 | // for (int i = 0; i < 7; i++) { | ||
21 | // gl_TexCoord[i].st = s + (i * blurDelta); | ||
22 | // } | ||
23 | |||
24 | // MANUALLY UNROLL | ||
25 | gl_TexCoord[0].st = s; | ||
26 | gl_TexCoord[1].st = s + blurDelta; | ||
27 | gl_TexCoord[2].st = s + (2. * blurDelta); | ||
28 | gl_TexCoord[3].st = s + (3. * blurDelta); | ||
29 | gl_TexCoord[4].st = s + (4. * blurDelta); | ||
30 | gl_TexCoord[5].st = s + (5. * blurDelta); | ||
31 | gl_TexCoord[6].st = s + (6. * blurDelta); | ||
32 | |||
33 | // gl_TexCoord[0].st = s; | ||
34 | // gl_TexCoord[1].st = blurDelta; | ||
35 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/colorFilterF.glsl new file mode 100644 index 0000000..623ef7a --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/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/class3/effects/drawQuadV.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/drawQuadV.glsl new file mode 100644 index 0000000..29c2a09 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/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/class3/effects/extractF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl new file mode 100644 index 0000000..a1583b1 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/effects/extractF.glsl | |||
@@ -0,0 +1,22 @@ | |||
1 | /** | ||
2 | * @file extractF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | uniform float extractLow; | ||
10 | uniform float extractHigh; | ||
11 | uniform vec3 lumWeights; | ||
12 | |||
13 | void main(void) | ||
14 | { | ||
15 | /// Get scene color | ||
16 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
17 | |||
18 | /// Extract luminance and scale up by night vision brightness | ||
19 | float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights)); | ||
20 | |||
21 | gl_FragColor = vec4(vec3(lum), 1.0); | ||
22 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/nightVisionF.glsl new file mode 100644 index 0000000..271d5cf --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/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 | } | ||
diff --git a/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl b/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl new file mode 100644 index 0000000..e55d278 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class3/effects/simpleF.glsl | |||
@@ -0,0 +1,14 @@ | |||
1 | /** | ||
2 | * @file simpleF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | uniform sampler2DRect RenderTexture; | ||
9 | |||
10 | void main(void) | ||
11 | { | ||
12 | vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st)); | ||
13 | gl_FragColor = vec4(1.0 - color, 1.0); | ||
14 | } | ||