FXAA, why not use Depth

Started by
9 comments, last by B_old 11 years, 8 months ago
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?

NBA2K, Madden, Maneater, Killing Floor, Sims http://www.pawlowskipinball.com/pinballeternal

Advertisement
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.

Depth will give you an exact edge

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 wanted 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.
Depth alone also isn't enough to detect discontinuities in normals or other material parameters at triangle edges.
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.

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.

How do you get the edge information into the stencil buffer?

[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.

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.
I'm worried about high contrast textures getting blurred as a result of fxaa.
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 :)
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.

I just detect and render the edge in the first pass[...].

Any more info on that part?

Any more info on that part?


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.

This topic is closed to new replies.

Advertisement