PDA

View Full Version : FXAA doesn't work with alpha blending



phaikawl
06-02-2014, 09:07 AM
I applied FXAA version 3.11 on my program. It works when drawing the whole texture without alpha blending (yes smooth edges).
However when I draw on a white background (cleared with glClear), and use alpha blending with "glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)", I can see the black pixels around the edges (the pixels that are used by FXAA to smoothen, they look black), and they don't blend with the background.
There is some sort of problem with the color, I don't figure out how to fix. Please help.
My full C source and fxaa shader in attachment.

Ilian Dinev
06-02-2014, 01:10 PM
FXAA depends on the depthbuffer iirc; your management of depth-test and depth-writes is completely nonexistent.

phaikawl
06-02-2014, 05:34 PM
FXAA depends on the depthbuffer iirc; your management of depth-test and depth-writes is completely nonexistent.
Can you clarify? How does it depend on the depthbuffer? Not the edge detection right? Because it detects normally and I know it uses luma to detect.
I tried enabling the depth buffer in the framebuffer or disabling the depth test, nothing changes.
What do you suggest to change?