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

@@ -5,13 +5,13 @@
* $License$
*/
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;
uniform sampler2DRect tex0;
uniform float brightness;
uniform float contrast;
uniform vec3 contrastBase;
@@ -24,7 +24,7 @@ VARYING vec2 vary_texcoord0;
void main(void)
{
vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0.st));
vec3 color = vec3(texture2DRect(tex0, vary_texcoord0.st));
/// Apply gamma
color = pow(color, vec3(1.0/gamma));

View File

@@ -0,0 +1,35 @@
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
uniform sampler2DRect tex0;
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(tex0, vary_texcoord0))*weight.x;
if(horizontalPass == 1)
{
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s+offset.s,vary_texcoord0.t)));
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s-offset.s,vary_texcoord0.t)));
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s+offset.t,vary_texcoord0.t)));
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s-offset.t,vary_texcoord0.t)));
}
else
{
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.s)));
color += weight.y * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.s)));
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t+offset.t)));
color += weight.z * vec3(texture2DRect(tex0, vec2(vary_texcoord0.s,vary_texcoord0.t-offset.t)));
}
gl_FragColor = vec4(color.xyz,1.0);
}

View File

@@ -5,14 +5,14 @@
* $License$
*/
#extension GL_ARB_texture_rectangle : enable
#ifdef DEFINE_GL_FRAGCOLOR
out vec4 gl_FragColor;
#endif
#extension GL_ARB_texture_rectangle : enable
uniform sampler2DRect RenderTexture;
uniform sampler2D NoiseTexture;
uniform sampler2DRect tex0;
uniform sampler2D tex1;
uniform float brightMult;
uniform float noiseStrength;
@@ -30,7 +30,7 @@ float luminance(vec3 color)
void main(void)
{
/// Get scene color
vec3 color = vec3(texture2DRect(RenderTexture, vary_texcoord0));
vec3 color = vec3(texture2DRect(tex0, vary_texcoord0));
/// Extract luminance and scale up by night vision brightness
float lum = luminance(color) * brightMult;
@@ -40,7 +40,7 @@ void main(void)
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;
float noiseValue = texture2D(tex1, vary_texcoord1).r;
noiseValue = (noiseValue - 0.5) * noiseStrength;
/// Older NVG colors (more muted)

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);
}