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

@ -27,8 +27,10 @@ in vec2 uv0;
uniform sampler2D prepassBuffer;
uniform sampler1D depthViz;
out vec4 OUT_col;
void main()
{
float depth = prepassUncondition( prepassBuffer, uv0 ).w;
OUT_FragColor0 = vec4( texture( depthViz, depth ).rgb, 1.0 );
OUT_col = vec4( texture( depthViz, depth ).rgb, 1.0 );
}

View file

@ -26,10 +26,12 @@
in vec2 uv0;
uniform sampler2D lightInfoBuffer;
out vec4 OUT_col;
void main()
{
vec3 lightcolor;
float nl_Att, specular;
lightinfoUncondition( texture( lightInfoBuffer, uv0 ), lightcolor, nl_Att, specular );
OUT_FragColor0 = vec4( lightcolor, 1.0 );
OUT_col = vec4( lightcolor, 1.0 );
}

View file

@ -26,10 +26,12 @@
in vec2 uv0;
uniform sampler2D lightInfoBuffer;
out vec4 OUT_col;
void main()
{
vec3 lightcolor;
float nl_Att, specular;
lightinfoUncondition( texture( lightInfoBuffer, uv0 ), lightcolor, nl_Att, specular );
OUT_FragColor0 = vec4( specular, specular, specular, 1.0 );
OUT_col = vec4( specular, specular, specular, 1.0 );
}

View file

@ -26,8 +26,10 @@
in vec2 uv0;
uniform sampler2D prepassBuffer;
out vec4 OUT_col;
void main()
{
vec3 normal = prepassUncondition( prepassBuffer, uv0 ).xyz;
OUT_FragColor0 = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
OUT_col = vec4( ( normal + 1.0 ) * 0.5, 1.0 );
}

View file

@ -25,8 +25,10 @@ in vec2 uv0;
uniform sampler2D shadowMap;
uniform sampler1D depthViz;
out vec4 OUT_col;
void main()
{
float depth = saturate( texture( shadowMap, uv0 ).r );
OUT_FragColor0 = vec4( texture( depthViz, depth ).rgb, 1 );
OUT_col = vec4( texture( depthViz, depth ).rgb, 1 );
}

View file

@ -122,6 +122,7 @@ uniform mat3 viewToLightProj;
uniform vec4 lightParams;
uniform float shadowSoftness;
out vec4 OUT_col;
void main()
{
@ -229,5 +230,5 @@ void main()
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
}

View file

@ -63,6 +63,8 @@ uniform mat4 viewToLightProj;
uniform vec4 lightParams;
uniform float shadowSoftness;
out vec4 OUT_col;
void main()
{
// Compute scene UV
@ -162,5 +164,5 @@ void main()
addToResult = ( 1.0 - shadowed ) * abs(lightMapParams);
}
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
}

View file

@ -62,6 +62,8 @@ uniform vec4 farPlaneScalePSSM;
uniform vec4 overDarkPSSM;
uniform float shadowSoftness;
out vec4 OUT_col;
void main()
{
// Sample/unpack the normal/z data
@ -227,6 +229,6 @@ void main()
lightColorOut = debugColor;
#endif
OUT_FragColor0 = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
OUT_col = lightinfoCondition( lightColorOut, Sat_NL_Att, specular, addToResult );
}

View file

@ -31,16 +31,16 @@ uniform vec2 oneOverTargetSize;
const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 );
const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 );
out vec4 OUT_col;
void main()
{
vec4 OUT = texture( diffuseMap, uv ) * weight[0];
OUT_col = texture( diffuseMap, uv ) * weight[0];
for ( int i=1; i < 3; i++ )
{
vec2 _sample = (BLUR_DIR * offset[i]) * oneOverTargetSize;
OUT += texture( diffuseMap, uv + _sample ) * weight[i];
OUT += texture( diffuseMap, uv - _sample ) * weight[i];
OUT_col += texture( diffuseMap, uv + _sample ) * weight[i];
OUT_col += texture( diffuseMap, uv - _sample ) * weight[i];
}
OUT_FragColor0 = OUT;
}

View file

@ -28,6 +28,8 @@ uniform vec2 blurDimension;
in vec2 tex0;
out vec4 OUT_col;
void main()
{
// Preshader
@ -43,5 +45,5 @@ void main()
accum += texture(diffuseMap0, BaseTexCoord + float(i) * SampleOffset);
}
accum /= blurSamples;
OUT_FragColor0 = accum;
OUT_col = accum;
}