This commit is contained in:
Siana Gearz
2011-02-13 22:01:18 +01:00
25 changed files with 587 additions and 442 deletions

View File

@@ -10,6 +10,7 @@ uniform sampler2D diffuseMap;
void main()
{
gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy));
//gl_FragColor = vec4(1,1,1,gl_Color.a * texture2D(diffuseMap, gl_TexCoord[0].xy)); //This should not compile!
gl_FragColor = vec4(1,1,1,texture2D(diffuseMap, gl_TexCoord[0].xy).a * gl_Color.a);
}

View File

@@ -8,24 +8,20 @@
uniform sampler2D diffuseMap;
uniform float glowStrength;
float kern[4] = float[4](.25,.5,.8,1.0); //Initialize the correct (non nVidia cg) way
void main()
{
vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
// ATI compiler falls down on array initialization.
float kern[8];
kern[0] = 0.25; kern[1] = 0.5; kern[2] = 0.8; kern[3] = 1.0;
kern[4] = 1.0; kern[5] = 0.8; kern[6] = 0.5; kern[7] = 0.25;
col += kern[0] * texture2D(diffuseMap, gl_TexCoord[0].xy);
col += kern[1] * texture2D(diffuseMap, gl_TexCoord[1].xy);
col += kern[2] * texture2D(diffuseMap, gl_TexCoord[2].xy);
col += kern[3] * texture2D(diffuseMap, gl_TexCoord[3].xy);
col += kern[4] * texture2D(diffuseMap, gl_TexCoord[0].zw);
col += kern[5] * texture2D(diffuseMap, gl_TexCoord[1].zw);
col += kern[6] * texture2D(diffuseMap, gl_TexCoord[2].zw);
col += kern[7] * texture2D(diffuseMap, gl_TexCoord[3].zw);
col += kern[3] * texture2D(diffuseMap, gl_TexCoord[0].zw);
col += kern[2] * texture2D(diffuseMap, gl_TexCoord[1].zw);
col += kern[1] * texture2D(diffuseMap, gl_TexCoord[2].zw);
col += kern[0] * texture2D(diffuseMap, gl_TexCoord[3].zw);
gl_FragColor = vec4(col.rgb * glowStrength, col.a);
}

View File

@@ -9,21 +9,18 @@ uniform sampler2DRect RenderTexture;
uniform float bloomStrength;
varying vec4 gl_TexCoord[gl_MaxTextureCoords];
float blurWeights[4] = float[4](.05,.1,.2,.3);
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];
}
vec3 color = blurWeights[0] * texture2DRect(RenderTexture, gl_TexCoord[0].st).rgb;
color+= blurWeights[1] * texture2DRect(RenderTexture, gl_TexCoord[1].st).rgb;
color+= blurWeights[2] * texture2DRect(RenderTexture, gl_TexCoord[2].st).rgb;
color+= blurWeights[3] * texture2DRect(RenderTexture, gl_TexCoord[3].st).rgb;
color+= blurWeights[2] * texture2DRect(RenderTexture, gl_TexCoord[4].st).rgb;
color+= blurWeights[1] * texture2DRect(RenderTexture, gl_TexCoord[5].st).rgb;
color+= blurWeights[0] * texture2DRect(RenderTexture, gl_TexCoord[6].st).rgb;
color *= bloomStrength;

View File

@@ -12,12 +12,15 @@ uniform vec3 contrastBase;
uniform float saturation;
uniform vec3 lumWeights;
const float gamma = 2.0;
uniform float gamma;
void main(void)
{
vec3 color = vec3(texture2DRect(RenderTexture, gl_TexCoord[0].st));
/// Apply gamma
color = pow(color, vec3(1.0/gamma));
/// Modulate brightness
color *= brightness;

View File

@@ -0,0 +1,28 @@
uniform sampler2DRect RenderTexture;
uniform int horizontalPass;
uniform float offset[2] = float[2]( 1.3846153846, 3.2307692308 );
uniform float weight[3] = float[3]( 0.2270270270, 0.3162162162, 0.0702702703 );
void main(void)
{
vec4 color = texture2DRect(RenderTexture, gl_TexCoord[0].st)*weight[0];
if(horizontalPass == 1)
{
color += weight[1] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x+offset[0],gl_TexCoord[0].y));
color += weight[1] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x-offset[0],gl_TexCoord[0].y));
color += weight[2] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x+offset[1],gl_TexCoord[0].y));
color += weight[2] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x-offset[1],gl_TexCoord[0].y));
}
else
{
color += weight[1] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x,gl_TexCoord[0].y+offset[0]));
color += weight[1] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x,gl_TexCoord[0].y-offset[0]));
color += weight[2] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x,gl_TexCoord[0].y+offset[1]));
color += weight[2] * texture2DRect(RenderTexture, vec2(gl_TexCoord[0].x,gl_TexCoord[0].y-offset[1]));
}
gl_FragColor = color;
}

View File

@@ -151,6 +151,8 @@
<real>1.5</real>
<key>bloom_width</key>
<real>2.25</real>
<key>gamma</key>
<real>1.0</real>
<key>brightness</key>
<real>1</real>
<key>brightness_multiplier</key>
@@ -170,6 +172,10 @@
<boolean>0</boolean>
<key>enable_night_vision</key>
<boolean>0</boolean>
<key>enable_gauss_blur</key>
<boolean>0</boolean>
<key>gauss_blur_passes</key>
<integer>2</integer>
<key>extract_high</key>
<real>1</real>
<key>extract_low</key>