SMAA: The quest for better anti-aliasing
Dictator93
Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
Kind of a not-all-too important post, but the anti-aliasing option in NS2 has bothered me from some time. As everyone knows, the game uses FXAA due to its deferred renderer and has very few options in the way of traditional MSAA. FXAA may be good because it is cheap to use and works in a deferred renderer, but it has a number of drawbacks.
1. Softening and blurring of image leading to decreased micro-detail
2. Decrease in specular color/brightness
3. Increased aliasing due to sub-pixel problems (telephone wires, railings, etc... in the distance will actually look worse)
4. Increased temporal-aliasing in some cases
In contrast to FXAA (Fast Aproximate Anti-Aliasing), an alternative solution developed to solve the same problems of aliasing in a deferred renderer: namely, SMAA (Sub-Pixel Morphological Anti-aliasing). SMAA does not have the aforementioned of drawbacks of FXAA (softening, blurring, color distortion, increased aliasing), whilst still working well and even decreasing aliasing more so on average! Its performance is similar and or a tiny bit worse.
Therefore, I recommend to the devs at UWE to switch out FXAA for SMAA (a similar solution), or at least offer the option to switch between the two.
Here are some (rather large) comparison screenshots to show the difference.
NO AA
<img src="http://www.abload.de/img/noaa9yup9.png" border="0" class="linked-image" />
SMAA
<img src="http://www.abload.de/img/smaa5iu5y.png" border="0" class="linked-image" />
FXAA
<img src="http://www.abload.de/img/fxaa5ou90.png" border="0" class="linked-image" />
Comparison .gif
<img src="http://www.abload.de/img/comparisonpoq14.gif" border="0" class="linked-image" />
Once again, not a big deal and far from an important thing for 1.0, but I think it should be integrated in game (before HUD rendering just like the FXAA currently is). Thanks for any replies and commentary in advance!
EDIT: Added comparison .gif
1. Softening and blurring of image leading to decreased micro-detail
2. Decrease in specular color/brightness
3. Increased aliasing due to sub-pixel problems (telephone wires, railings, etc... in the distance will actually look worse)
4. Increased temporal-aliasing in some cases
In contrast to FXAA (Fast Aproximate Anti-Aliasing), an alternative solution developed to solve the same problems of aliasing in a deferred renderer: namely, SMAA (Sub-Pixel Morphological Anti-aliasing). SMAA does not have the aforementioned of drawbacks of FXAA (softening, blurring, color distortion, increased aliasing), whilst still working well and even decreasing aliasing more so on average! Its performance is similar and or a tiny bit worse.
Therefore, I recommend to the devs at UWE to switch out FXAA for SMAA (a similar solution), or at least offer the option to switch between the two.
Here are some (rather large) comparison screenshots to show the difference.
NO AA
<img src="http://www.abload.de/img/noaa9yup9.png" border="0" class="linked-image" />
SMAA
<img src="http://www.abload.de/img/smaa5iu5y.png" border="0" class="linked-image" />
FXAA
<img src="http://www.abload.de/img/fxaa5ou90.png" border="0" class="linked-image" />
Comparison .gif
<img src="http://www.abload.de/img/comparisonpoq14.gif" border="0" class="linked-image" />
Once again, not a big deal and far from an important thing for 1.0, but I think it should be integrated in game (before HUD rendering just like the FXAA currently is). Thanks for any replies and commentary in advance!
EDIT: Added comparison .gif
Comments
I use the SMAA injector in as much games as I can.
The screenshots speak for themselves.
No, I was just going to say that my eye sight must be getting bad because I can't tell any difference between the 3 screen shots.
But out of those screenies, I do feel like the FXAA looks better than SMAA...
Look at the railings, the Axe, the staircase, the red Terran Hologram.
SMAA shows more clarity whereas FXAA has it blurred.
Have all 3 screenshots up, and switch between each one showing the same spot.
You can see how FXAA softens and blurs the detail through this
<img src="http://www.abload.de/img/comparisonpoq14.gif" border="0" class="linked-image" />
Maybe not the best location to showcase what is meant by the OP, but check out the the specular highlights and the tiny details
So NS2 uses this FXAA which blurs things. That explains why I always have to sharpen screen shots to make them look right.
If you can't tell the difference between the shots open them in new tabs then switch between tabs to compare.
Basically without AA there are lots of jagged outlines.
With SMAA the jagged outlines are smoothed over.
With FXAA - everything - is slightly blurred, not only the jagged outlines. The hatchet now looks blunt instead of sharp and you cannot see fine detail clearly in the hologram.
Look at the railings, the Axe, the staircase, the red Terran Hologram.
SMAA shows more clarity whereas FXAA has it blurred.
Have all 3 screenshots up, and switch between each one showing the same spot.<!--QuoteEnd--></div><!--QuoteEEnd-->
You're right, now that I have something to focus on I can see that SMAA does look better than FXAA.
With FXAA, the blurring is noticeable in play for me and that goes for every game that uses FXAA. Using FXAA makes my eyes feel out of focus.
Isn't MSAA possible with deferred rendering in DX10.1 and onward? I still firmly believe MSAA has the best image quality, but I have yet to use TXAA since there is only one game that supports it.
Isn't MSAA possible with deferred rendering in DX10.1 and onward? I still firmly believe MSAA has the best image quality, but I have yet to use TXAA since there is only one game that supports it.<!--QuoteEnd--></div><!--QuoteEEnd-->
MSAA is possible in dx10 with deffered rendering. DX10.1 cards can just do it better (more efficiently). MSAA has great image quality, but misses some edges: namely, transparencies and temporal some specular shading problems (shimmering due to movement I think). That can only be solved with nice super-sampling (down sampling), or some temporal aliasing like that found in TXAA or a normal TAA solution
<!--coloro:#DDA0DD--><span style="color:#DDA0DD"><!--/coloro--><b>Repository:</b><!--colorc--></span><!--/colorc--> <a href="https://github.com/iryoku/smaa" target="_blank">https://github.com/iryoku/smaa</a>
It would be <b>REAL NICE</b> if we got SMAA. FXAA can sometimes produce a worse IQ than no AA at all.
However, a few patches we made the rendering pipeline data driven, which means it's largely configured through data files which can be modded. FXAA is implemented entirely through the data driven features (as is ambient occlusion and bloom), so this means you could create a SMAA mod if you were so inclined. You can see the related files in core/renderer directory. core/renderer/Deferred.render_setup is the main file that configures the rendering pipeline.
By we, I mean the rest of you guys, because I don't think I should be messing around with rendering files :3
However, a few patches we made the rendering pipeline data driven, which means it's largely configured through data files which can be modded. FXAA is implemented entirely through the data driven features (as is ambient occlusion and bloom), so this means you could create a SMAA mod if you were so inclined. You can see the related files in core/renderer directory. core/renderer/Deferred.render_setup is the main file that configures the rendering pipeline.<!--QuoteEnd--></div><!--QuoteEEnd-->
Max, I really appreciate the reply. Knowing this I shall got to work. Let us see what I can do!
I suggest reading the comments found here: <a href="https://github.com/iryoku/smaa/blob/master/SMAA.h" target="_blank">https://github.com/iryoku/smaa/blob/master/SMAA.h</a>
My personal preference is SMAA ~ T2X
I guess a couple things need to be understood first. "don't try to integrate SMAA T2x with predicated edge detection from the start!"
It also looks like their directx10 demo is using it so T2X may be off limits to the spark engine (dx9 only?).
icenhancer for GTA was actually one of the inspirations for making is modable.
I believe Dictator93 is using SMAA 1 in his screenshots. SMAA 1 is very mild compared to the quality of the other versions.
A better comparison can be found here: <a href="http://www.iryoku(DOT)com/smaa/downloads/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.mp4" target="_blank">http://www.iryoku(DOT)com/smaa/downloads/S...ntialiasing.mp4</a> <u><b>223mb</b></u>
Or here: <a href="http://vimeo.com/31247769" target="_blank">http://vimeo.com/31247769</a> <b>turn HD->ON ; fullscreen ; Disable Scaling</b>
The temporal AA achieved in SMAA T2x becomes extremely apparent with motion where pixel crawl is relatively non-existent versus other implementations. T2x also greatly reduces aliasing on inner mesh edges.
@Anyone who can prove or disprove: There is a comment in the SMAA T2X <a href="https://github.com/iryoku/smaa/blob/master/Demo/DX10/Shaders/Simple.fx" target="_blank">simple.fx</a> which mentions "...that for providing the jitter in non-homogeneous projection space, pixel coordinates (screen space) need to multiplied by two in the C++ code)". The 'C++ code' is referring to their <a href="https://github.com/iryoku/smaa/blob/master/Demo/DX10/Code/Demo.cpp" target="_blank">DX10 demo</a> in this case. It somewhat seems like T2x may be unachievable without the guys from unknownworlds providing us with something along the lines of: simpleEffect->GetVariableByName("jitter")->AsVector()->SetFloatVector((float *) jitterProjectionSpace).
Btw the render_setup stuff is really cool.
Funny, like I had _exactly the same idea_ but didn't post it. The SMAA paper is quite interesting, and honestly: the AA race is just over. That stuff tromps any other AA (besides SSAA, but that's out of the scope). That stuff runs pretty efficient on even XBOX and PS3, seeing the bandwidth requirements. The only problem is: NVIDIA wants to push its FSAA (or FXAA? well I always switch these), and SMAA has to be directly supported by the engine.
I was the one asking the "render features for the future" question on the twitch stream, and when Max answered with the datadriven renderer, I had exactly "SMAA" in my mind. And then I look at this post.. kinda weird feeling when you think you're the only freak, and find out you're not. :)
Now sadly I'm more a C# and Javascript guy, with a very weak background in C++ and ASM. I guess with enough time (> 1 week of work) I could get something to work, but somehow I'm too lazy.. read the technical paper, take the algos, learn HLSL or whatever Spark uses..
<b>Is anyone in the community skilled enough and up for the task?</b>
Duddenhoffers SMAA injector worked for many games, has anyone tried that for NS2? <a href="http://mrhaandi.blogspot.de/p/injectsmaa.html" target="_blank">http://mrhaandi.blogspot.de/p/injectsmaa.html</a> One should deactivate the Steam overlay with this.. other games had a problem with this.
I'm almost never impressed by so called "realistic rendering" stuff, but this Jiminez and his team are god. He just nailed it. And it runs on 40FPS, adjustable, on a midrange card. Just by stepping ahead, alot of work, dedication, and not fearing to go DX10 only. Probably will be in Crysis3, hinted in the comments. I'm seriously a bit freaked out right now, last time was a long long time ago..
A better comparison can be found here: <a href="http://www.iryoku(DOT)com/smaa/downloads/SMAA-Enhanced-Subpixel-Morphological-Antialiasing.mp4" target="_blank">http://www.iryoku(DOT)com/smaa/downloads/S...ntialiasing.mp4</a> <u><b>223mb</b></u>
Or here: <a href="http://vimeo.com/31247769" target="_blank">http://vimeo.com/31247769</a> <b>turn HD->ON ; fullscreen ; Disable Scaling</b>
The temporal AA achieved in SMAA T2x becomes extremely apparent with motion where pixel crawl is relatively non-existent versus other implementations. T2x also greatly reduces aliasing on inner mesh edges.
@Anyone who can prove or disprove: There is a comment in the SMAA T2X <a href="https://github.com/iryoku/smaa/blob/master/Demo/DX10/Shaders/Simple.fx" target="_blank">simple.fx</a> which mentions "...that for providing the jitter in non-homogeneous projection space, pixel coordinates (screen space) need to multiplied by two in the C++ code)". The 'C++ code' is referring to their <a href="https://github.com/iryoku/smaa/blob/master/Demo/DX10/Code/Demo.cpp" target="_blank">DX10 demo</a> in this case. It somewhat seems like T2x may be unachievable without the guys from unknownworlds providing us with something along the lines of: simpleEffect->GetVariableByName("jitter")->AsVector()->SetFloatVector((float *) jitterProjectionSpace).
Btw the render_setup stuff is really cool.<!--QuoteEnd--></div><!--QuoteEEnd-->
I'm really sorry for breaking the feel of this thread, but as soon as I loaded up your SMAA video, I was like- "I've heard this before."
Then I realized it was a slightly different version of the TRON: Legacy theme. It made a vid about anti-aliasing a little more awesome lol
Then you really need to see an ophthalmologist, or put your glasses on.
It is so strong without SMAA that it is giving me a headache.