Imported existing code
This commit is contained in:
31
indra/newview/app_settings/shaders/class2/effects/blurF.glsl
Normal file
31
indra/newview/app_settings/shaders/class2/effects/blurF.glsl
Normal file
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file blurf.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect RenderTexture;
|
||||
uniform float bloomStrength;
|
||||
|
||||
varying vec4 gl_TexCoord[gl_MaxTextureCoords];
|
||||
void main(void)
|
||||
{
|
||||
float blurWeights[7];
|
||||
blurWeights[0] = 0.05;
|
||||
blurWeights[1] = 0.1;
|
||||
blurWeights[2] = 0.2;
|
||||
blurWeights[3] = 0.3;
|
||||
blurWeights[4] = 0.2;
|
||||
blurWeights[5] = 0.1;
|
||||
blurWeights[6] = 0.05;
|
||||
|
||||
vec3 color = vec3(0,0,0);
|
||||
for (int i = 0; i < 7; i++){
|
||||
color += vec3(texture2DRect(RenderTexture, gl_TexCoord[i].st)) * blurWeights[i];
|
||||
}
|
||||
|
||||
color *= bloomStrength;
|
||||
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
35
indra/newview/app_settings/shaders/class2/effects/blurV.glsl
Normal file
35
indra/newview/app_settings/shaders/class2/effects/blurV.glsl
Normal file
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @file blurV.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform vec2 texelSize;
|
||||
uniform vec2 blurDirection;
|
||||
uniform float blurWidth;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
// Transform vertex
|
||||
gl_Position = ftransform();
|
||||
|
||||
vec2 blurDelta = texelSize * blurDirection * vec2(blurWidth, blurWidth);
|
||||
vec2 s = gl_MultiTexCoord0.st - (blurDelta * 3.0);
|
||||
|
||||
// for (int i = 0; i < 7; i++) {
|
||||
// gl_TexCoord[i].st = s + (i * blurDelta);
|
||||
// }
|
||||
|
||||
// MANUALLY UNROLL
|
||||
gl_TexCoord[0].st = s;
|
||||
gl_TexCoord[1].st = s + blurDelta;
|
||||
gl_TexCoord[2].st = s + (2. * blurDelta);
|
||||
gl_TexCoord[3].st = s + (3. * blurDelta);
|
||||
gl_TexCoord[4].st = s + (4. * blurDelta);
|
||||
gl_TexCoord[5].st = s + (5. * blurDelta);
|
||||
gl_TexCoord[6].st = s + (6. * blurDelta);
|
||||
|
||||
// gl_TexCoord[0].st = s;
|
||||
// gl_TexCoord[1].st = blurDelta;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @file colorFilterF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect RenderTexture;
|
||||
uniform float brightness;
|
||||
uniform float contrast;
|
||||
uniform vec3 contrastBase;
|
||||
uniform float saturation;
|
||||
uniform vec3 lumWeights;
|
||||
|
||||
const float gamma = 2.0;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
|
||||
|
||||
/// Modulate brightness
|
||||
color *= brightness;
|
||||
|
||||
/// Modulate contrast
|
||||
color = mix(contrastBase, color, contrast);
|
||||
|
||||
/// Modulate saturation
|
||||
color = mix(vec3(dot(color, lumWeights)), color, saturation);
|
||||
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @file drawQuadV.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
void main(void)
|
||||
{
|
||||
//transform vertex
|
||||
gl_Position = ftransform();
|
||||
gl_TexCoord[0] = gl_MultiTexCoord0;
|
||||
gl_TexCoord[1] = gl_MultiTexCoord1;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* @file extractF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect RenderTexture;
|
||||
uniform float extractLow;
|
||||
uniform float extractHigh;
|
||||
uniform vec3 lumWeights;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
/// Get scene color
|
||||
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
|
||||
|
||||
/// Extract luminance and scale up by night vision brightness
|
||||
float lum = smoothstep(extractLow, extractHigh, dot(color, lumWeights));
|
||||
|
||||
gl_FragColor = vec4(vec3(lum), 1.0);
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/**
|
||||
* @file nightVisionF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect RenderTexture;
|
||||
uniform sampler2D NoiseTexture;
|
||||
uniform float brightMult;
|
||||
uniform float noiseStrength;
|
||||
|
||||
float luminance(vec3 color)
|
||||
{
|
||||
/// CALCULATING LUMINANCE (Using NTSC lum weights)
|
||||
/// http://en.wikipedia.org/wiki/Luma_%28video%29
|
||||
return dot(color, vec3(0.299, 0.587, 0.114));
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
/// Get scene color
|
||||
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
|
||||
|
||||
/// Extract luminance and scale up by night vision brightness
|
||||
float lum = luminance(color) * brightMult;
|
||||
|
||||
/// Convert into night vision color space
|
||||
/// Newer NVG colors (crisper and more saturated)
|
||||
vec3 outColor = (lum * vec3(0.91, 1.21, 0.9)) + vec3(-0.07, 0.1, -0.12);
|
||||
|
||||
/// Add noise
|
||||
float noiseValue = texture2D(NoiseTexture, gl_TexCoord[1].st).r;
|
||||
noiseValue = (noiseValue - 0.5) * noiseStrength;
|
||||
|
||||
/// Older NVG colors (more muted)
|
||||
// vec3 outColor = (lum * vec3(0.82, 0.75, 0.83)) + vec3(0.05, 0.32, -0.11);
|
||||
|
||||
outColor += noiseValue;
|
||||
|
||||
gl_FragColor = vec4(outColor, 1.0);
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @file simpleF.glsl
|
||||
*
|
||||
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
|
||||
* $License$
|
||||
*/
|
||||
|
||||
uniform sampler2DRect RenderTexture;
|
||||
|
||||
void main(void)
|
||||
{
|
||||
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
|
||||
gl_FragColor = vec4(1.0 - color, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user