Clean GLSL fragment shader out.

This commit is contained in:
LuisAntonRebollo 2014-11-30 22:56:30 +01:00
parent 87f34e3c4f
commit ed0febea39
135 changed files with 451 additions and 239 deletions

View file

@ -32,6 +32,8 @@ uniform float distCoeff;
uniform float cubeDistort;
uniform vec3 colorDistort;
out vec4 OUT_col;
void main()
{
vec2 tex = IN_uv0;
@ -56,5 +58,5 @@ void main()
outColor[i] = tex2Dlod( backBuffer, vec4(x,y,0,0) )[i];
}
OUT_FragColor0 = vec4( outColor.rgb, 1 );
OUT_col = vec4( outColor.rgb, 1 );
}

View file

@ -28,10 +28,12 @@ uniform float damageFlash;
uniform float whiteOut;
uniform sampler2D backBuffer;
out vec4 OUT_col;
void main()
{
vec4 color1 = texture(backBuffer, IN_uv0);
vec4 color2 = color1 * MUL_COLOR;
vec4 damage = mix(color1,color2,damageFlash);
OUT_FragColor0 = mix(damage,WHITE_COLOR,whiteOut);
OUT_col = mix(damage,WHITE_COLOR,whiteOut);
}

View file

@ -34,6 +34,8 @@ uniform vec4 rtParams0;
in vec2 uv0;
in vec3 wsEyeRay;
out vec4 OUT_col;
void main()
{
//vec2 prepassCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy;
@ -46,5 +48,5 @@ void main()
fogData.y,
fogData.z );
OUT_FragColor0 = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) );
OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) );
}

View file

@ -31,6 +31,8 @@ uniform float OneOverGamma;
in vec2 uv0;
out vec4 OUT_col;
void main()
{
vec4 color = texture(backBuffer, uv0.xy);
@ -43,5 +45,5 @@ void main()
// Apply gamma correction
color.rgb = pow( abs(color.rgb), vec3(OneOverGamma) );
OUT_FragColor0 = color;
OUT_col = color;
}

View file

@ -34,25 +34,26 @@ in vec2 uv5; //TEXCOORD5;
in vec2 uv6; //TEXCOORD6;
in vec2 uv7; //TEXCOORD7;
out vec4 OUT_col;
void main()
{
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f;
vec4 OUT = vec4(0);
OUT += texture( diffuseMap, uv0 ) * kernel.x;
OUT += texture( diffuseMap, uv1 ) * kernel.y;
OUT += texture( diffuseMap, uv2 ) * kernel.z;
OUT += texture( diffuseMap, uv3 ) * kernel.w;
vec4 OUT_col = vec4(0);
OUT_col += texture( diffuseMap, uv0 ) * kernel.x;
OUT_col += texture( diffuseMap, uv1 ) * kernel.y;
OUT_col += texture( diffuseMap, uv2 ) * kernel.z;
OUT_col += texture( diffuseMap, uv3 ) * kernel.w;
OUT += texture( diffuseMap, uv4 ) * kernel.x;
OUT += texture( diffuseMap, uv5 ) * kernel.y;
OUT += texture( diffuseMap, uv6 ) * kernel.z;
OUT += texture( diffuseMap, uv7 ) * kernel.w;
OUT_col += texture( diffuseMap, uv4 ) * kernel.x;
OUT_col += texture( diffuseMap, uv5 ) * kernel.y;
OUT_col += texture( diffuseMap, uv6 ) * kernel.z;
OUT_col += texture( diffuseMap, uv7 ) * kernel.w;
// Calculate a lumenance value in the alpha so we
// can use alpha test to save fillrate.
vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 );
OUT.a = dot( OUT.rgb, rgb2lum );
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
OUT_FragColor0 = OUT;
}

View file

@ -37,6 +37,8 @@ uniform float velocityMultiplier;
uniform sampler2D backBuffer;
uniform sampler2D prepassTex;
out vec4 OUT_col;
void main()
{
vec2 IN_uv0 = _IN_uv0;
@ -72,5 +74,5 @@ void main()
color += currentColor;
}
OUT_FragColor0 = color / samples;
OUT_col = color / samples;
}

View file

@ -25,7 +25,9 @@
in vec2 uv0;
uniform sampler2D inputTex ;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture( inputTex, uv0 );
OUT_col = texture( inputTex, uv0 );
}

View file

@ -34,6 +34,8 @@ in vec2 uv0;
#define IN_uv0 uv0
out vec4 OUT_col;
void main()
{
float speed = 2.0;
@ -46,5 +48,5 @@ void main()
y = clamp(y, targetViewport.y, targetViewport.w);
x = clamp(x, targetViewport.x, targetViewport.z);
OUT_FragColor0 = texture (inputTex, vec2(x, y));
OUT_col = texture (inputTex, vec2(x, y));
}

View file

@ -51,6 +51,8 @@ uniform vec2 nearFar;
uniform vec4 rtParams0;
uniform float waterDepthGradMax;
out vec4 OUT_col;
void main()
{
//vec2 prepassCoord = IN_uv0;
@ -134,5 +136,5 @@ void main()
vec3 outColor = mix( inColor, fogColor.rgb, fogAmt );
OUT_FragColor0 = vec4( hdrEncode( outColor ), 1 );
OUT_col = vec4( hdrEncode( outColor ), 1 );
}