mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Clean GLSL fragment shader out.
This commit is contained in:
parent
87f34e3c4f
commit
ed0febea39
135 changed files with 451 additions and 239 deletions
|
|
@ -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 );
|
||||
}
|
||||
|
|
@ -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 );
|
||||
}
|
||||
|
|
@ -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 );
|
||||
}
|
||||
|
|
@ -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 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue