Sign in to follow this  
dpadam450

FXAA, why not use Depth

Recommended Posts

I have not implemented FXAA yet due to not needing to. But I find it odd that they are trying to find edges by luminance instead of depth. Depth will give you an exact edge. From the Nvidia demo paper it shows a mostly non-contrasted image. I saw another nvidia youtube video showing real games using it but it doesn't show the edge detection that it picks up from the algorithm. I'm worried about high contrast textures getting blurred as a result of fxaa. So why not use depth (linearized before had or in pixel shader)? Is there a downside that I'm missing? Edited by dpadam450

Share this post


Link to post
Share on other sites
There are AA alorithms out there that use depth. But the big seller for FXAA is, that it only needs the backbuffer as input and does everything in one fairly simple pass. It's simple to integrate and fast to boot.

It can also smoothe edges with no depth information, for example reflections or refractions, as well as edges created by post processing.

In my experience, purely image based algorithms don't get signigicantly better than that.

Share this post


Link to post
Share on other sites
[quote name='dpadam450' timestamp='1343250854' post='4963067']
Depth will give you an exact edge
[/quote]
This is not always the case. I.e. I render lot of things which don't update the depth buffer (particles, effects, outlines etc.), in this case a depth depending AA would introduce some very ugly artifacts. A pure image based algorithm has the advantage of being usable for almost every rendering technique around, even if it has the disadvantage of smoothing out [i]wanted[/i] contrasts. But to be honest, if you have textures with very high contrasts, you will have some other artifacts without AA applied to the texture itself, i.e. flickering when moving.

Share this post


Link to post
Share on other sites
In my project I detect the edge using depth first, then use the stencil buffer to do FXAA only on the edge,just like in MLAA. Doing this increased the efficiency,and it also avoid FXAA to blur sharp pixels.

Share this post


Link to post
Share on other sites
[quote name='dragon.R' timestamp='1343637063' post='4964422']
In my project I detect the edge using depth first, then use the stencil buffer to do FXAA only on the edge,just like in MLAA. Doing this increased the efficiency,and it also avoid FXAA to blur sharp pixels.
[/quote]
How do you get the edge information into the stencil buffer?

Share this post


Link to post
Share on other sites
[quote name='B_old' timestamp='1343637635' post='4964424']
[quote name='dragon.R' timestamp='1343637063' post='4964422']
In my project I detect the edge using depth first, then use the stencil buffer to do FXAA only on the edge,just like in MLAA. Doing this increased the efficiency,and it also avoid FXAA to blur sharp pixels.
[/quote]
How do you get the edge information into the stencil buffer?
[/quote]

I just detect and render the edge in the first pass,open the stencil writting.So I can clip pixels using stencil test in the FXAA pass.

Share this post


Link to post
Share on other sites
[quote name='dpadam450' timestamp='1343250854' post='4963067']I'm worried about high contrast textures getting blurred as a result of fxaa.[/quote]Yes, high-contrast textures that produce aliasing will be anti-aliased. You'll have to tune/judge the algorithm on your scene to see if it's acceptable. It doesn't take long to integrate :)
[quote]So why not use depth?[/quote]Because that wasn't Mr Lottes' design goal -- making an luminosity-based edge filter was.
Also, geometrical-edge aliasing isn't the only cause of aliasing (as mentioned above), for me, the softening of shader-aliasing was very useful.

Share this post


Link to post
Share on other sites
[quote name='dragon.R' timestamp='1343638173' post='4964427']
I just detect and render the edge in the first pass[...].
[/quote]
Any more info on that part?

Share this post


Link to post
Share on other sites
[quote name='B_old' timestamp='1343726342' post='4964780']
Any more info on that part?
[/quote]

It`s same to the first pass of MLAA,which was introduced in the <GPU PRO2>.Render a screen quad and sample the depth to find edge,discard other pixels.

Share this post


Link to post
Share on other sites
[quote name='dragon.R' timestamp='1343791970' post='4965072']
[quote name='B_old' timestamp='1343726342' post='4964780']
Any more info on that part?
[/quote]

It`s same to the first pass of MLAA,which was introduced in the <GPU PRO2>.Render a screen quad and sample the depth to find edge,discard other pixels.
[/quote]
OK, thanks!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this