FXAA - Fast Approximate Anti-Aliasing

Lately, we’ve been working on a tech demo to showcase our virtual texturing extension. After deciding to go for deferred rendering, we started looking for a good post-process anti-aliasing approximation technique.

Not long after testing a few AA solutions, including NFAA and Unity’s luminance edge blur, we ended up porting FXAA over to Unity. While it isn’t without it’s problems, it gave us very acceptable results:

We figured that some of you might also have a use for this AA technique so we decided to share it.

This FXAA package is available as a free download:
https://dl.dropboxusercontent.com/u/14079608/FXAA3.unitypackage

To make it work, simply:

  1. Install the package
  2. Select your camera object
  3. Add the component “Image Effects/FXAA”

No need to tweak any parameters, just plug and play.

I was called into attention that a FXAA Unity port has already been accomplished by gaustwick a while before. He’s been comparing several techniques with FXAA and posted the results. Feel free to check out his thread.

2 Likes

Thanks Diego. I am still not decided if use forward, or deffered mode or combine both. Which problems have you find with this technique?

thank you very much for this!

looking awesome

This image shows two major problems with this technique: long poly edges + loss of contrast in non-edge areas

However, I’m sure these are universal issues in post-processing AA techniques. Overall the results are still very acceptable.

The second issue might be fixable with a contrast enhancement filter.

Thanks for sharing this is awesome!

Thanks, this really helped.

I have some problem with deffered lightning in general, some shadows are blinking like disco when camera is moving. It can be solved by drastic increase of bias, but then majority of shadows is not connected to object. But this is probably Unity BUG, I am curious about promised shadows improvements in 3.4.

Cheers, everyone.

What type of light generates those problems you’re having? Cascades help on directional lights. Using a short range might also help precision; this should be valid for all types.

Wow. This looks great. From the images, there’s really a lot of difference. :smile:

This is impressive, with no tweaking required, I believe it looks better than the luminance edge blur, fantastic!

ty!

Perhaps a stupid question, but bears asking - is this compatible with Unity Indie?

Great stuff. Thx for passing it along.

Since Indie can’t use deferred rendering, it’s a moot point.

–Eric

Diogo - did you see my thread in the shaderlab forum about the latest FXAA?

I did a comparison of the deferred renderer quality with each version.

I completely missed it, to be honest. I usually just visit the Showcase forum.

This one was based on 3_9. It’s interesting to see how much it evolved.

Very nice! Thanks for sharing with us!

does it work on iOS?

Again, there is no deferred rendering on iOS, so it’s a moot point. Just use MSAA if you want anti-aliasing, you don’t need a shader that emulates it.

–Eric

This new version might work (was excluding the gles target):
http://dl.dropbox.com/u/14079608/FXAA3.unitypackage

I don’t have access to iOS hw so I can’t confirm this. Let me know if that works for you, and how fast.

MSAA and this FXAA combined creates some serious soft edges, they both work together so even if your not using deferred rendering, you can use this shader along with the built in AA in unity, it makes extremely soft edges.