Fixed extra post-process shaders. Cleaned up and no longer using deprecated functions.

This commit is contained in:
Shyotl
2011-12-16 01:46:20 -06:00
parent a53e08032f
commit 0030ca3af7
12 changed files with 227 additions and 508 deletions

View File

@@ -1,42 +0,0 @@
/**
* @file colorFilterF.glsl
*
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
* $License$
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;
uniform float brightness;
uniform float contrast;
uniform vec3 contrastBase;
uniform float saturation;
uniform vec3 lumWeights;
uniform float gamma;
VARYING vec2 vary_texcoord0;
void main(void)
{
vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
/// Apply gamma
color = pow(color, vec3(1.0/gamma));
/// 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);
}

View File

@@ -1,36 +0,0 @@
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;
uniform int horizontalPass;
VARYING vec2 vary_texcoord0;
vec2 offset = vec2( 1.3846153846, 3.2307692308 );
vec3 weight = vec3( 0.2270270270, 0.3162162162, 0.0702702703 );
void main(void)
{
vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0))*weight.x;
if(horizontalPass == 1)
{
color += weight.y * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s+offset.s,vary_texcoord0.t)));
color += weight.y * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s-offset.s,vary_texcoord0.t)));
color += weight.z * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s+offset.t,vary_texcoord0.t)));
color += weight.z * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s-offset.t,vary_texcoord0.t)));
}
else
{
color += weight.y * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.s)));
color += weight.y * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.s)));
color += weight.z * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.t)));
color += weight.z * vec3(texture2DRect(RenderTexture, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.t)));
}
gl_FragColor = vec4(color.xyz,1.0);
}

View File

@@ -1,52 +0,0 @@
/**
* @file nightVisionF.glsl
*
* Copyright (c) 2007-$CurrentYear$, Linden Research, Inc.
* $License$
*/
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;
uniform sampler2D NoiseTexture;
uniform float brightMult;
uniform float noiseStrength;
VARYING vec2 vary_texcoord0;
VARYING vec2 vary_texcoord1;
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, vary_texcoord0));
/// 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, vary_texcoord1).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);
}