diff options
Diffstat (limited to 'linden/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl')
-rw-r--r-- | linden/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/linden/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl b/linden/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl new file mode 100644 index 0000000..dbdfe11 --- /dev/null +++ b/linden/indra/newview/app_settings/shaders/class1/effects/glowExtractF.glsl | |||
@@ -0,0 +1,28 @@ | |||
1 | /** | ||
2 | * @file glowExtractF.glsl | ||
3 | * | ||
4 | * Copyright (c) 2007-$CurrentYear$, Linden Research, Inc. | ||
5 | * $License$ | ||
6 | */ | ||
7 | |||
8 | #extension GL_ARB_texture_rectangle : enable | ||
9 | |||
10 | uniform sampler2DRect diffuseMap; | ||
11 | uniform float minLuminance; | ||
12 | uniform float maxExtractAlpha; | ||
13 | uniform vec3 lumWeights; | ||
14 | uniform vec3 warmthWeights; | ||
15 | uniform float warmthAmount; | ||
16 | |||
17 | void main() | ||
18 | { | ||
19 | vec4 col = texture2DRect(diffuseMap, gl_TexCoord[0].xy); | ||
20 | |||
21 | /// CALCULATING LUMINANCE (Using NTSC lum weights) | ||
22 | /// http://en.wikipedia.org/wiki/Luma_%28video%29 | ||
23 | float lum = smoothstep(minLuminance, 1.0, dot(col.rgb, lumWeights ) ); | ||
24 | float warmth = smoothstep(minLuminance, 1.0, max(col.r * warmthWeights.r, max(col.g * warmthWeights.g, col.b * warmthWeights.b)) ); | ||
25 | |||
26 | gl_FragColor.rgb = col.rgb; | ||
27 | gl_FragColor.a = max(col.a, mix(lum, warmth, warmthAmount) * maxExtractAlpha); | ||
28 | } | ||