Skip to content

Commit

Permalink
transparent background AA was breaking on shitty ATI test card. remove
Browse files Browse the repository at this point in the history
  • Loading branch information
serge-rgb committed Jan 28, 2017
1 parent bb39572 commit 9618cb2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
@@ -1,5 +1,5 @@
The MIT License (MIT)
Copyright (c) 2015-2016 Sergio Gonzalez
Copyright (c) 2015-2017 Sergio Gonzalez

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
14 changes: 2 additions & 12 deletions src/postproc.f.glsl
Expand Up @@ -28,22 +28,12 @@ main()
float ph = 1 / u_screen_size.y;
vec2 coord = gl_FragCoord.xy / u_screen_size;

// Read neighboring pixels. If one of them is vec4(0), then do a different AA pass. Otherwise we
// would blend with a black background when we are exporting it as transparent.

int nz = 0;
nz += int(vec4(0) != texture(u_canvas, coord, 0));
nz += int(vec4(0) != texture(u_canvas, coord + vec2(0, ph), 0));
nz += int(vec4(0) != texture(u_canvas, coord + vec2(pw, 0), 0));
nz += int(vec4(0) != texture(u_canvas, coord + vec2(0, -ph), 0));
nz += int(vec4(0) != texture(u_canvas, coord + vec2(-pw, 0), 0));
// TODO: When exporting to a transparent background, FXAA will blend-in the background color.
// Find a fix

out_color = texture(u_canvas, coord, 0);

if ( nz != 5) {
out_color.a = out_color.a * (nz / 5.0);
}
else
out_color.rgb = FxaaPixelShader(
// Use noperspective interpolation here (turn off perspective interpolation).
// {xy} = center of pixel
Expand Down

0 comments on commit 9618cb2

Please sign in to comment.