Adds a FXAA for smoothing out the extracted outlines. The Post Process Anti Aliasing is only done on the Alpha channel of the outlines. Because of that we need to add bleed the outline color out of the silouhette so the AA'd alpha can blend the right color and not pick black when the alpha is smoothed out of the silhouette. Also because of the AA needs to have clear contrast to work with, I decided to ditch the "bluring" or the occluded outlines. The FXAA adds an overhead of 0.17ms but we gain back 0.22ms * 4 = 0.88ms by removing the blur. The FXAA Implementation is from Corey Richardson (cmr) (D2717). I had to modify it a bit to only filter the alpha channel.
28 lines
434 B
GLSL
28 lines
434 B
GLSL
|
|
in vec4 uvcoordsvar;
|
|
|
|
out vec4 FragColor;
|
|
|
|
uniform sampler2D outlineBluredColor;
|
|
uniform vec2 rcpDimensions;
|
|
|
|
void main()
|
|
{
|
|
#ifdef USE_FXAA
|
|
float aa_alpha = FxaaPixelShader(
|
|
uvcoordsvar.st,
|
|
outlineBluredColor,
|
|
rcpDimensions,
|
|
1.0,
|
|
0.166,
|
|
0.0833
|
|
).r;
|
|
#endif
|
|
|
|
FragColor = texture(outlineBluredColor, uvcoordsvar.st).rgba;
|
|
|
|
#ifdef USE_FXAA
|
|
FragColor.a = aa_alpha;
|
|
#endif
|
|
}
|