Merge pull request #988 from BeamNG/clean_opengl_fragment_out

Clean GLSL fragment shader out.
This commit is contained in:
LuisAntonRebollo 2014-12-01 01:28:05 +01:00
commit 5e74a465a9
135 changed files with 451 additions and 239 deletions

View file

@ -75,7 +75,7 @@ void ShaderGenPrinterGLSL::printPixelShaderOutputStruct( Stream& stream, const M
}
WRITESTR(avar("//Fragment shader OUT\r\n"));
//WRITESTR(avar("out vec4 OUT_col;\r\n", i)); // @todo OUT_col defined on hlslCompat.glsl
WRITESTR(avar("out vec4 OUT_col;\r\n"));
for( U32 i = 1; i < 4; i++ )
{
if( numMRTs & 1 << i )

View file

@ -24,9 +24,9 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a);
OUT_col = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a);
}

View file

@ -22,9 +22,9 @@
in vec4 color;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = color;
OUT_col = color;
}

View file

@ -24,9 +24,9 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord) * color;
OUT_col = texture(diffuseMap, texCoord) * color;
}

View file

@ -23,9 +23,9 @@
uniform sampler2D diffuseMap;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord);
OUT_col = texture(diffuseMap, texCoord);
}

View file

@ -30,8 +30,10 @@ in vec2 texCoord;
uniform sampler2D diffuseMap ;
out vec4 OUT_col;
void main()
{
vec4 col = texture( diffuseMap, IN_texCoord );
OUT_FragColor0 = hdrEncode( col );
OUT_col = hdrEncode( col );
}

View file

@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
in vec2 texc0, texc1, texc2, texc3;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texc0) * kernel.x;
OUT_FragColor0 += texture(diffuseMap, texc1) * kernel.y;
OUT_FragColor0 += texture(diffuseMap, texc2) * kernel.z;
OUT_FragColor0 += texture(diffuseMap, texc3) * kernel.w;
OUT_col = texture(diffuseMap, texc0) * kernel.x;
OUT_col += texture(diffuseMap, texc1) * kernel.y;
OUT_col += texture(diffuseMap, texc2) * kernel.z;
OUT_col += texture(diffuseMap, texc3) * kernel.w;
}

View file

@ -47,6 +47,8 @@ uniform float cloudCoverage;
uniform vec3 cloudBaseColor;
uniform float cloudExposure;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
@ -141,5 +143,5 @@ void main()
cResultColor.a = mix( cResultColor.a, 0.0, 1.0 - pow(IN_worldDist,2.0) );
OUT_FragColor0 = cResultColor;
OUT_col = cResultColor;
}

View file

@ -29,12 +29,14 @@ uniform vec4 groundAlpha;
in vec4 color, groundAlphaCoeff;
in vec2 outTexCoord, alphaLookup;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
void main()
{
vec4 alpha = texture(alphaMap, alphaLookup);
OUT_FragColor0 = color * texture(diffuseMap, outTexCoord);
OUT_FragColor0.a = OUT_FragColor0.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
OUT_col = color * texture(diffuseMap, outTexCoord);
OUT_col.a = OUT_col.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
}

View file

@ -100,7 +100,4 @@ mat4 mat4FromRow( float r0c0, float r0c1, float r0c2, float r0c3,
#ifdef TORQUE_PIXEL_SHADER
void clip(float a) { if(a < 0) discard;}
out vec4 OUT_col;
#define OUT_FragColor0 OUT_col
#endif

View file

@ -38,6 +38,7 @@ uniform sampler2D edgeSource;
uniform vec4 edgeTargetParams;
#endif
out vec4 OUT_col;
void main()
{
@ -57,5 +58,5 @@ void main()
#endif
// Sample offscreen target and return
OUT_FragColor0 = texture( colorSource, uvScene.xy );
OUT_col = texture( colorSource, uvScene.xy );
}

View file

@ -78,6 +78,8 @@ vec4 lmSample( vec3 nrm )
uniform float alphaFactor;
uniform float alphaScale;
out vec4 OUT_col;
void main()
{
float softBlend = 1;
@ -100,12 +102,12 @@ void main()
vec4 diffuse = texture( diffuseMap, IN_uv0 );
//OUT_FragColor0 = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
//OUT_col = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
// Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha)
vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) );
OUT_FragColor0 = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
IN_color.a * diffuse.a * softBlend * alphaScale ) );
}

View file

@ -29,6 +29,8 @@ uniform vec4 shadeColor;
in vec2 TEX0;
in vec4 TEX1;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Fade edges of axis for texcoord passed in
//-----------------------------------------------------------------------------
@ -64,5 +66,5 @@ void main()
vec4 diffuseColor = texture( diffuseMap, TEX0 );
vec4 reflectColor = textureProj( refractMap, texIndex );
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
}

View file

@ -29,6 +29,8 @@ uniform vec4 shadeColor;
in vec2 TEX0;
in vec4 TEX1;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
@ -37,5 +39,5 @@ void main()
vec4 diffuseColor = texture( diffuseMap, TEX0 );
vec4 reflectColor = textureProj( refractMap, TEX1 );
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
}

View file

@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord) * color;
OUT_col = texture(diffuseMap, texCoord) * color;
}

View file

@ -24,7 +24,7 @@ in vec2 texCoord;
in vec4 color;
in float fade;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
uniform sampler2D inputTex;
uniform vec4 ambient;
@ -33,5 +33,5 @@ uniform vec4 ambient;
void main()
{
float shadow = texture( inputTex, texCoord ).a * color.a;
OUT_FragColor0 = ( ambient * shadow ) + ( 1 - shadow );
OUT_col = ( ambient * shadow ) + ( 1 - shadow );
}

View file

@ -43,6 +43,8 @@ uniform float useCubemap;
uniform vec3 lightDir;
uniform vec3 sunDir;
out vec4 OUT_col;
void main()
{
@ -62,7 +64,7 @@ void main()
float fac = dot( normalize( pos ), sunDir );
fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) );
OUT_FragColor0 = mix( color, nightSkyColor, nightInterpAndExposure.y );
OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y );
// Clip based on the camera-relative
// z position of the vertex, passed through
@ -70,6 +72,6 @@ void main()
if(zPosition < 0.0)
discard;
OUT_FragColor0.a = 1;
OUT_FragColor0 = hdrEncode( OUT_FragColor0 );
OUT_col.a = 1;
OUT_col = hdrEncode( OUT_col );
}

View file

@ -267,6 +267,6 @@ void fizzle(vec2 vpos, float visibility)
/// @param condition This should be a bvec[2-4]. If any items is false, condition is considered to fail.
/// @param color The color that should be outputted if the condition fails.
/// @note This macro will only work in the void main() method of a pixel shader.
#define assert(condition, color) { if(!any(condition)) { OUT_FragColor0 = color; return; } }
#define assert(condition, color) { if(!any(condition)) { OUT_col = color; return; } }
#endif // _TORQUE_GLSL_

View file

@ -33,6 +33,8 @@ in vec4 outLightVec;
in vec3 outPos;
in vec3 outEyePos;
out vec4 OUT_col;
void main()
{
vec2 texOffset;
@ -45,11 +47,11 @@ void main()
vec4 bumpNorm = texture(bumpMap, texOffset) * 2.0 - 1.0;
vec4 diffuse = texture(diffMap, texOffset);
OUT_FragColor0 = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
OUT_col = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
vec3 eyeVec = normalize(outEyePos - outPos);
vec3 halfAng = normalize(eyeVec + outLightVec.xyz);
float specular = clamp(dot(bumpNorm.xyz, halfAng), 0.0, 1.0) * outLightVec.w;
specular = pow(specular, specularPower);
OUT_FragColor0 += specularColor * specular;
OUT_col += specularColor * specular;
}

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

View file

@ -34,6 +34,8 @@ uniform sampler2D causticsTex0;
uniform sampler2D causticsTex1;
uniform vec2 targetSize;
out vec4 OUT_col;
float distanceToPlane(vec4 plane, vec3 pos)
{
return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w;
@ -48,7 +50,7 @@ void main()
float depth = prePass.w;
if(depth > 0.9999)
{
OUT_FragColor0 = vec4(0,0,0,0);
OUT_col = vec4(0,0,0,0);
return;
}
@ -59,7 +61,7 @@ void main()
float waterDepth = -distanceToPlane(waterFogPlane, pos);
if(waterDepth < 0)
{
OUT_FragColor0 = vec4(0,0,0,0);
OUT_col = vec4(0,0,0,0);
return;
}
waterDepth = saturate(waterDepth);
@ -81,5 +83,5 @@ void main()
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(1-depth, 64) * waterDepth;
OUT_FragColor0 = caustics;
OUT_col = caustics;
}

View file

@ -25,7 +25,9 @@
// These are set by the game engine.
uniform sampler2D shrunkSampler; // Output of DofDownsample()
uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler
uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler
out vec4 OUT_col;
// This is the pixel shader function that calculates the actual
// value used for the near circle of confusion.
@ -46,8 +48,8 @@ void main()
coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a;
//OUT_FragColor0 = vec4( coc.rrr, 1.0 );
//OUT_FragColor0 = vec4( color, 1.0 );
OUT_FragColor0 = vec4( color, coc );
//OUT_FragColor0 = vec4( 1.0, 0.0, 1.0, 1.0 );
//OUT_col = vec4( coc.rrr, 1.0 );
//OUT_col = vec4( color, 1.0 );
OUT_col = vec4( color, coc );
//OUT_col = vec4( 1.0, 0.0, 1.0, 1.0 );
}

View file

@ -47,6 +47,8 @@ in vec2 tcDepth2;
in vec2 tcDepth3;
#define IN_tcDepth3 tcDepth3
out vec4 OUT_col;
void main()
{
//return vec4( 1.0, 0.0, 1.0, 1.0 );
@ -131,8 +133,8 @@ void main()
maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) );
//OUT_FragColor0 = half4( 1.0, 0.0, 1.0, 1.0 );
OUT_FragColor0 = half4( color, maxCoc );
//OUT_FragColor0 = half4( color, 1.0f );
//OUT_FragColor0 = half4( maxCoc.rrr, 1.0 );
//OUT_col = half4( 1.0, 0.0, 1.0, 1.0 );
OUT_col = half4( color, maxCoc );
//OUT_col = half4( color, 1.0f );
//OUT_col = half4( maxCoc.rrr, 1.0 );
}

View file

@ -41,6 +41,8 @@ uniform float maxFarCoC;
//static vec4 dofLerpBias = vec4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 );
//static vec3 dofEqFar = vec3( 2.0, 0.0, 1.0 );
out vec4 OUT_col;
vec4 tex2Doffset( sampler2D s, vec2 tc, vec2 offset )
{
return texture( s, tc + offset * oneOverTargetSize );
@ -141,5 +143,5 @@ void main()
//return half4(nearCoc.rrr,1);
//return half4( 1,0,1,0 );
OUT_FragColor0 = InterpolateDof( small, med.rgb, large, coc );
OUT_col = InterpolateDof( small, med.rgb, large, coc );
}

View file

@ -42,7 +42,7 @@ in vec2 uv6;
in vec2 uv7;
#define IN_uv7 uv7
#define OUT OUT_FragColor0
out vec4 OUT_col;
uniform sampler2D diffuseMap;
@ -50,19 +50,19 @@ void main()
{
vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f;
OUT = vec4(0);
OUT += texture( diffuseMap, IN_uv0 ) * kernel.x;
OUT += texture( diffuseMap, IN_uv1 ) * kernel.y;
OUT += texture( diffuseMap, IN_uv2 ) * kernel.z;
OUT += texture( diffuseMap, IN_uv3 ) * kernel.w;
OUT_col = vec4(0);
OUT_col += texture( diffuseMap, IN_uv0 ) * kernel.x;
OUT_col += texture( diffuseMap, IN_uv1 ) * kernel.y;
OUT_col += texture( diffuseMap, IN_uv2 ) * kernel.z;
OUT_col += texture( diffuseMap, IN_uv3 ) * kernel.w;
OUT += texture( diffuseMap, IN_uv4 ) * kernel.x;
OUT += texture( diffuseMap, IN_uv5 ) * kernel.y;
OUT += texture( diffuseMap, IN_uv6 ) * kernel.z;
OUT += texture( diffuseMap, IN_uv7 ) * kernel.w;
OUT_col += texture( diffuseMap, IN_uv4 ) * kernel.x;
OUT_col += texture( diffuseMap, IN_uv5 ) * kernel.y;
OUT_col += texture( diffuseMap, IN_uv6 ) * kernel.z;
OUT_col += texture( diffuseMap, IN_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 );
}

View file

@ -32,6 +32,8 @@ uniform sampler2D colorSampler; // Output of DofNearCoc()
in vec4 texCoords;
#define IN_texCoords texCoords
out vec4 OUT_col;
void main()
{
vec4 color;
@ -40,5 +42,5 @@ void main()
color += texture( colorSampler, IN_texCoords.yz );
color += texture( colorSampler, IN_texCoords.xw );
color += texture( colorSampler, IN_texCoords.yw );
OUT_FragColor0 = color / 4.0;
OUT_col = color / 4.0;
}

View file

@ -28,7 +28,9 @@ in vec2 uv0;
uniform sampler2D edgeBuffer;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = vec4( texture( edgeBuffer, IN_uv0 ).rrr, 1.0 );
OUT_col = vec4( texture( edgeBuffer, IN_uv0 ).rrr, 1.0 );
}

View file

@ -28,6 +28,8 @@ uniform sampler2D edgeBuffer;
uniform sampler2D backBuffer;
uniform vec2 targetSize;
out vec4 OUT_col;
void main()
{
vec2 pixelSize = 1.0 / targetSize;
@ -64,5 +66,5 @@ void main()
}
accumColor /= 9.0;
OUT_FragColor0 = accumColor;
OUT_col = accumColor;
}

View file

@ -88,7 +88,9 @@ in vec2 uv0;
uniform sampler2D prepassBuffer;
uniform vec2 targetSize;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
OUT_col = vec4( GetEdgeWeight(IN_uv0, prepassBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw);
}

View file

@ -34,9 +34,11 @@ uniform vec2 oneOverTargetSize;
in vec4 hpos;
in vec2 uv0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = FxaaPixelShader(
OUT_col = FxaaPixelShader(
uv0, // vertex position

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_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;
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;
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_FragColor0 = OUT;
OUT_col.a = dot( OUT_col.rgb, rgb2lum );
}

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

View file

@ -30,6 +30,8 @@ uniform float gaussMultiplier;
uniform float gaussMean;
uniform float gaussStdDev;
out vec4 OUT_col;
#define PI 3.141592654
float computeGaussianValue( float x, float mean, float std_deviation )
@ -66,5 +68,5 @@ void main()
color += (texture( inputTex, IN_uv0 + vec2( offset, 0.0f ) ) * weight );
}
OUT_FragColor0 = vec4( color.rgb, 1.0f );
OUT_col = vec4( color.rgb, 1.0f );
}

View file

@ -30,6 +30,8 @@ uniform float gaussMultiplier;
uniform float gaussMean;
uniform float gaussStdDev;
out vec4 OUT_col;
#define D3DX_PI 3.141592654
float computeGaussianValue( float x, float mean, float std_deviation )
@ -65,5 +67,5 @@ void main()
color += (texture( inputTex, IN_uv0 + vec2( 0.0f, offset ) ) * weight );
}
OUT_FragColor0 = vec4( color.rgb, 1.0f );
OUT_col = vec4( color.rgb, 1.0f );
}

View file

@ -33,6 +33,8 @@ uniform float g_fMiddleGray;
const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f);
out vec4 OUT_col;
const vec2 gTapOffsets[4] = vec2[]
(
@ -59,5 +61,5 @@ void main()
average = vec4( 0.0f, 0.0f, 0.0f, 1.0f );
// Write the colour to the bright-pass render target
OUT_FragColor0 = hdrEncode( average );
OUT_col = hdrEncode( average );
}

View file

@ -30,6 +30,8 @@ uniform sampler2D lastAdaptedLum;
uniform float adaptRate;
uniform float deltaTime;
out vec4 OUT_col;
void main()
{
float fAdaptedLum = texture( lastAdaptedLum, vec2(0.5f, 0.5f) ).r;
@ -42,5 +44,5 @@ void main()
float diff = fCurrentLum - fAdaptedLum;
float fNewAdaptation = fAdaptedLum + ( diff * ( 1.0 - exp( -deltaTime * adaptRate ) ) );
OUT_FragColor0 = vec4( fNewAdaptation, 0.0, 0.0, 1.0f );
OUT_col = vec4( fNewAdaptation, 0.0, 0.0, 1.0f );
}

View file

@ -30,6 +30,8 @@ in vec4 texCoords[8];
uniform sampler2D inputTex;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
@ -44,5 +46,5 @@ void main()
_sample += texture( inputTex, IN_texCoords[i].zw );
}
OUT_FragColor0 = _sample / 16;
OUT_col = _sample / 16;
}

View file

@ -43,6 +43,8 @@ uniform float g_fBloomScale;
uniform float g_fOneOverGamma;
out vec4 OUT_col;
void main()
{
@ -92,5 +94,5 @@ void main()
// Apply gamma correction
_sample.rgb = pow( abs(_sample.rgb), vec3(g_fOneOverGamma) );
OUT_FragColor0 = _sample;
OUT_col = _sample;
}

View file

@ -28,6 +28,8 @@
uniform sampler2D inputTex;
uniform float brightPassThreshold;
out vec4 OUT_col;
void main()
{
vec4 _sample = hdrDecode( texture( inputTex, IN_uv0 ) );
@ -36,5 +38,5 @@ void main()
float lum = hdrLuminance( _sample.rgb );
// Write the colour to the bright-pass render target
OUT_FragColor0 = ( vec4( lum.rrr, 1 ) );
OUT_col = ( vec4( lum.rrr, 1 ) );
}

View file

@ -29,6 +29,8 @@ uniform vec2 texSize0;
uniform float g_fMinLuminace;
out vec4 OUT_col;
const vec2 gTapOffsets[9] = vec2[]
(
vec2( -1.0, -1.0 ), vec2( 0.0, -1.0 ), vec2( 1.0, -1.0 ),
@ -56,5 +58,5 @@ void main()
average = exp( average / 9.0 );
OUT_FragColor0 = vec4( average, 0.0, 0.0, 1.0 );
OUT_col = vec4( average, 0.0, 0.0, 1.0 );
}

View file

@ -26,6 +26,7 @@
uniform sampler2D inputTex;
uniform vec2 oneOverTargetSize;
out vec4 OUT_col;
const vec2 gTapOffsets[16] = vec2[]
(
@ -47,5 +48,5 @@ void main()
average += lum;
}
OUT_FragColor0 = vec4( average / 16.0, 0.0, 0.0, 1.0 );
OUT_col = vec4( average / 16.0, 0.0, 0.0, 1.0 );
}

View file

@ -31,6 +31,7 @@ uniform float brightScalar;
const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f);
out vec4 OUT_col;
void main()
{
@ -50,5 +51,5 @@ void main()
col *= brightScalar;
}
OUT_FragColor0 = col;
OUT_col = col;
}

View file

@ -36,6 +36,8 @@ uniform float weight;
uniform float decay;
uniform float exposure;
out vec4 OUT_col;
void main()
{
vec4 texCoord = vec4( IN_uv0.xy, 0, 0 );
@ -55,7 +57,7 @@ void main()
if ( samples <= 0 )
{
OUT_FragColor0 = bbCol;
OUT_col = bbCol;
return;
}
@ -88,5 +90,5 @@ void main()
//return bbCol * decay;
// Output final color with a further scale control factor.
OUT_FragColor0 = saturate( amount ) * vec4( color * exposure, 1 ) + bbCol;
OUT_col = saturate( amount ) * vec4( color * exposure, 1 ) + bbCol;
}

View file

@ -34,6 +34,8 @@ uniform sampler2D edgesMap;
uniform sampler2D edgesMapL;
uniform sampler2D areaMap;
out vec4 OUT_col;
#include "./functions.glsl"
@ -77,5 +79,5 @@ void main()
areas.ba = Area(abs(d), e1, e2);
}
OUT_FragColor0 = areas;
OUT_col = areas;
}

View file

@ -39,6 +39,8 @@ uniform float depthThreshold;
in vec2 texcoord;
in vec4 offset[2];
out vec4 OUT_col;
void main()
{
// Luma calculation requires gamma-corrected colors (texture 'colorMapG').
@ -70,5 +72,5 @@ void main()
if (dot(edges, vec4(1.0)) == 0.0)
discard;
OUT_FragColor0 = edges;
OUT_col = edges;
}

View file

@ -40,6 +40,7 @@ uniform sampler2D areaMap;
uniform sampler2D edgesMapL;
#include "./functions.glsl"
out vec4 OUT_col;
void main()
{
@ -83,5 +84,5 @@ void main()
#endif
// Normalize the resulting color and we are finished!
OUT_FragColor0 = color / sum;
OUT_col = color / sum;
}

View file

@ -46,6 +46,7 @@ uniform sampler2D prepassMap ;
uniform float blurDepthTol;
uniform float blurNormalTol;
out vec4 OUT_col;
void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total )
{
@ -96,7 +97,7 @@ void main()
//occlusion /= (float)usedCount / 8.0;
occlusion /= total;
OUT_FragColor0 = vec4( vec3(occlusion), 1 );
OUT_col = vec4( vec3(occlusion), 1 );
//return vec4( 0,0,0,occlusion );

View file

@ -57,6 +57,8 @@ uniform float lDepthPow;
uniform float lNormalTol;
uniform float lNormalPow;
out vec4 OUT_col;
#ifndef QUALITY
#define QUALITY 2
@ -152,7 +154,7 @@ void main()
// Early out if too far away.
if ( depth > 0.99999999 )
{
OUT_FragColor0 = vec4( 0,0,0,0 );
OUT_col = vec4( 0,0,0,0 );
return;
}
@ -270,7 +272,7 @@ void main()
// seems backwards, but it makes it simple to deal with the SSAO
// being disabled in the lighting shaders.
OUT_FragColor0 = vec4(occlusion, vec3(0.0));
OUT_col = vec4(occlusion, vec3(0.0));
}

View file

@ -25,8 +25,10 @@
in vec2 uv0;
#define IN_uv0 uv0
out vec4 OUT_col;
void main()
{
float power = pow( max( IN_uv0.x, 0 ), 0.1 );
OUT_FragColor0 = vec4( power, 0, 0, 1 );
OUT_col = vec4( power, 0, 0, 1 );
}

View file

@ -33,6 +33,8 @@ uniform sampler2D textureMap;
uniform float texId;
uniform float layerSize;
out vec4 OUT_col;
void main()
{
vec4 layerSample = round(texture( layerTex, IN_layerCoord ) * 255.0);
@ -42,5 +44,5 @@ void main()
if(blend - 0.0001 < 0.0)
discard;
OUT_FragColor0 = vec4( texture( textureMap, IN_texCoord ).rgb, blend );
OUT_col = vec4( texture( textureMap, IN_texCoord ).rgb, blend );
}

View file

@ -111,6 +111,8 @@ uniform vec4 rippleMagnitude;
uniform vec4 specularParams;
uniform mat4 modelMat;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
@ -136,7 +138,7 @@ void main()
distortPos.xy += bumpNorm.xy * distortAmt;
#ifdef UNDERWATER
OUT_FragColor0 = hdrEncode( textureProj( refractBuff, distortPos ) );
OUT_col = hdrEncode( textureProj( refractBuff, distortPos ) );
#else
vec3 eyeVec = IN_objPos.xyz - eyePos;
@ -208,7 +210,7 @@ void main()
#endif
OUT_FragColor0 = OUT;
OUT_col = OUT;
#endif
}

View file

@ -145,6 +145,8 @@ uniform vec4 sunColor;
uniform float sunBrightness;
uniform float reflectivity;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
@ -390,5 +392,5 @@ void main()
//return OUT;
OUT_FragColor0 = hdrEncode( OUT );
OUT_col = hdrEncode( OUT );
}

View file

@ -24,9 +24,9 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a);
OUT_col = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a);
}

View file

@ -22,9 +22,9 @@
in vec4 color;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = color;
OUT_col = color;
}

View file

@ -24,9 +24,9 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord) * color;
OUT_col = texture(diffuseMap, texCoord) * color;
}

View file

@ -23,9 +23,9 @@
uniform sampler2D diffuseMap;
in vec2 texCoord;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord);
OUT_col = texture(diffuseMap, texCoord);
}

View file

@ -30,8 +30,10 @@ in vec2 texCoord;
uniform sampler2D diffuseMap ;
out vec4 OUT_col;
void main()
{
vec4 col = texture( diffuseMap, IN_texCoord );
OUT_FragColor0 = hdrEncode( col );
OUT_col = hdrEncode( col );
}

View file

@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
in vec2 texc0, texc1, texc2, texc3;
out vec4 OUT_col;
void main()
{
OUT_FragColor0 = texture(diffuseMap, texc0) * kernel.x;
OUT_FragColor0 += texture(diffuseMap, texc1) * kernel.y;
OUT_FragColor0 += texture(diffuseMap, texc2) * kernel.z;
OUT_FragColor0 += texture(diffuseMap, texc3) * kernel.w;
OUT_col = texture(diffuseMap, texc0) * kernel.x;
OUT_col += texture(diffuseMap, texc1) * kernel.y;
OUT_col += texture(diffuseMap, texc2) * kernel.z;
OUT_col += texture(diffuseMap, texc3) * kernel.w;
}

View file

@ -47,6 +47,8 @@ uniform float cloudCoverage;
uniform vec3 cloudBaseColor;
uniform float cloudExposure;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Globals
//-----------------------------------------------------------------------------
@ -141,5 +143,5 @@ void main()
cResultColor.a = mix( cResultColor.a, 0.0, 1.0 - pow(IN_worldDist,2.0) );
OUT_FragColor0 = cResultColor;
OUT_col = cResultColor;
}

View file

@ -29,12 +29,14 @@ uniform vec4 groundAlpha;
in vec4 color, groundAlphaCoeff;
in vec2 outTexCoord, alphaLookup;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
void main()
{
vec4 alpha = texture(alphaMap, alphaLookup);
OUT_FragColor0 = color * texture(diffuseMap, outTexCoord);
OUT_FragColor0.a = OUT_FragColor0.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
OUT_col = color * texture(diffuseMap, outTexCoord);
OUT_col.a = OUT_col.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x;
}

View file

@ -100,7 +100,4 @@ mat4 mat4FromRow( float r0c0, float r0c1, float r0c2, float r0c3,
#ifdef TORQUE_PIXEL_SHADER
void clip(float a) { if(a < 0) discard;}
out vec4 OUT_col;
#define OUT_FragColor0 OUT_col
#endif

View file

@ -38,6 +38,7 @@ uniform sampler2D edgeSource;
uniform vec4 edgeTargetParams;
#endif
out vec4 OUT_col;
void main()
{
@ -57,5 +58,5 @@ void main()
#endif
// Sample offscreen target and return
OUT_FragColor0 = texture( colorSource, uvScene.xy );
OUT_col = texture( colorSource, uvScene.xy );
}

View file

@ -78,6 +78,8 @@ vec4 lmSample( vec3 nrm )
uniform float alphaFactor;
uniform float alphaScale;
out vec4 OUT_col;
void main()
{
float softBlend = 1;
@ -100,12 +102,12 @@ void main()
vec4 diffuse = texture( diffuseMap, IN_uv0 );
//OUT_FragColor0 = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
//OUT_col = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale);
// Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha)
vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) );
OUT_FragColor0 = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale,
IN_color.a * diffuse.a * softBlend * alphaScale ) );
}

View file

@ -29,6 +29,8 @@ uniform vec4 shadeColor;
in vec2 TEX0;
in vec4 TEX1;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Fade edges of axis for texcoord passed in
//-----------------------------------------------------------------------------
@ -64,5 +66,5 @@ void main()
vec4 diffuseColor = texture( diffuseMap, TEX0 );
vec4 reflectColor = textureProj( refractMap, texIndex );
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
}

View file

@ -29,6 +29,8 @@ uniform vec4 shadeColor;
in vec2 TEX0;
in vec4 TEX1;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
@ -37,5 +39,5 @@ void main()
vec4 diffuseColor = texture( diffuseMap, TEX0 );
vec4 reflectColor = textureProj( refractMap, TEX1 );
OUT_FragColor0 = diffuseColor + reflectColor * diffuseColor.a;
OUT_col = diffuseColor + reflectColor * diffuseColor.a;
}

View file

@ -28,10 +28,12 @@ uniform sampler2D diffuseMap;
in vec4 color;
in vec2 texCoord;
out vec4 OUT_col;
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
void main()
{
OUT_FragColor0 = texture(diffuseMap, texCoord) * color;
OUT_col = texture(diffuseMap, texCoord) * color;
}

View file

@ -24,7 +24,7 @@ in vec2 texCoord;
in vec4 color;
in float fade;
out vec4 OUT_FragColor0;
out vec4 OUT_col;
uniform sampler2D inputTex;
uniform vec4 ambient;
@ -33,5 +33,5 @@ uniform vec4 ambient;
void main()
{
float shadow = texture( inputTex, texCoord ).a * color.a;
OUT_FragColor0 = ( ambient * shadow ) + ( 1 - shadow );
OUT_col = ( ambient * shadow ) + ( 1 - shadow );
}

View file

@ -43,6 +43,8 @@ uniform float useCubemap;
uniform vec3 lightDir;
uniform vec3 sunDir;
out vec4 OUT_col;
void main()
{
@ -62,7 +64,7 @@ void main()
float fac = dot( normalize( pos ), sunDir );
fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) );
OUT_FragColor0 = mix( color, nightSkyColor, nightInterpAndExposure.y );
OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y );
// Clip based on the camera-relative
// z position of the vertex, passed through
@ -70,6 +72,6 @@ void main()
if(zPosition < 0.0)
discard;
OUT_FragColor0.a = 1;
OUT_FragColor0 = hdrEncode( OUT_FragColor0 );
OUT_col.a = 1;
OUT_col = hdrEncode( OUT_col );
}

View file

@ -267,6 +267,6 @@ void fizzle(vec2 vpos, float visibility)
/// @param condition This should be a bvec[2-4]. If any items is false, condition is considered to fail.
/// @param color The color that should be outputted if the condition fails.
/// @note This macro will only work in the void main() method of a pixel shader.
#define assert(condition, color) { if(!any(condition)) { OUT_FragColor0 = color; return; } }
#define assert(condition, color) { if(!any(condition)) { OUT_col = color; return; } }
#endif // _TORQUE_GLSL_

View file

@ -33,6 +33,8 @@ in vec4 outLightVec;
in vec3 outPos;
in vec3 outEyePos;
out vec4 OUT_col;
void main()
{
vec2 texOffset;
@ -45,11 +47,11 @@ void main()
vec4 bumpNorm = texture(bumpMap, texOffset) * 2.0 - 1.0;
vec4 diffuse = texture(diffMap, texOffset);
OUT_FragColor0 = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
OUT_col = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient);
vec3 eyeVec = normalize(outEyePos - outPos);
vec3 halfAng = normalize(eyeVec + outLightVec.xyz);
float specular = clamp(dot(bumpNorm.xyz, halfAng), 0.0, 1.0) * outLightVec.w;
specular = pow(specular, specularPower);
OUT_FragColor0 += specularColor * specular;
OUT_col += specularColor * specular;
}

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

@ -121,7 +121,8 @@ uniform vec4 vsFarPlane;
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;
}

View file

@ -34,6 +34,8 @@ uniform sampler2D causticsTex0;
uniform sampler2D causticsTex1;
uniform vec2 targetSize;
out vec4 OUT_col;
float distanceToPlane(vec4 plane, vec3 pos)
{
return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w;
@ -48,7 +50,7 @@ void main()
float depth = prePass.w;
if(depth > 0.9999)
{
OUT_FragColor0 = vec4(0,0,0,0);
OUT_col = vec4(0,0,0,0);
return;
}
@ -59,7 +61,7 @@ void main()
float waterDepth = -distanceToPlane(waterFogPlane, pos);
if(waterDepth < 0)
{
OUT_FragColor0 = vec4(0,0,0,0);
OUT_col = vec4(0,0,0,0);
return;
}
waterDepth = saturate(waterDepth);
@ -81,5 +83,5 @@ void main()
//float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1);
caustics *= saturate(prePass.z) * pow(1-depth, 64) * waterDepth;
OUT_FragColor0 = caustics;
OUT_col = caustics;
}

View file

@ -27,6 +27,8 @@
uniform sampler2D shrunkSampler; // Output of DofDownsample()
uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler
out vec4 OUT_col;
// This is the pixel shader function that calculates the actual
// value used for the near circle of confusion.
// "texCoords" are 0 at the bottom left pixel and 1 at the top right.
@ -46,8 +48,8 @@ void main()
coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a;
//OUT_FragColor0 = vec4( coc.rrr, 1.0 );
//OUT_FragColor0 = vec4( color, 1.0 );
OUT_FragColor0 = vec4( color, coc );
//OUT_FragColor0 = vec4( 1.0, 0.0, 1.0, 1.0 );
//OUT_col = vec4( coc.rrr, 1.0 );
//OUT_col = vec4( color, 1.0 );
OUT_col = vec4( color, coc );
//OUT_col = vec4( 1.0, 0.0, 1.0, 1.0 );
}

View file

@ -47,6 +47,8 @@ in vec2 tcDepth2;
in vec2 tcDepth3;
#define IN_tcDepth3 tcDepth3
out vec4 OUT_col;
void main()
{
//return vec4( 1.0, 0.0, 1.0, 1.0 );
@ -131,8 +133,8 @@ void main()
maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) );
//OUT_FragColor0 = half4( 1.0, 0.0, 1.0, 1.0 );
OUT_FragColor0 = half4( color, maxCoc );
//OUT_FragColor0 = half4( color, 1.0f );
//OUT_FragColor0 = half4( maxCoc.rrr, 1.0 );
//OUT_col = half4( 1.0, 0.0, 1.0, 1.0 );
OUT_col = half4( color, maxCoc );
//OUT_col = half4( color, 1.0f );
//OUT_col = half4( maxCoc.rrr, 1.0 );
}

View file

@ -41,6 +41,8 @@ uniform float maxFarCoC;
//static vec4 dofLerpBias = vec4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 );
//static vec3 dofEqFar = vec3( 2.0, 0.0, 1.0 );
out vec4 OUT_col;
vec4 tex2Doffset( sampler2D s, vec2 tc, vec2 offset )
{
return texture( s, tc + offset * oneOverTargetSize );
@ -141,5 +143,5 @@ void main()
//return half4(nearCoc.rrr,1);
//return half4( 1,0,1,0 );
OUT_FragColor0 = InterpolateDof( small, med.rgb, large, coc );
OUT_col = InterpolateDof( small, med.rgb, large, coc );
}

Some files were not shown because too many files have changed in this diff Show more