SMAA: The quest for better anti-aliasing

Dictator93Dictator93 Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
edited October 2012 in NS2 General Discussion
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

Comments

  • Zomb3hZomb3h Join Date: 2011-01-27 Member: 79241Members, Reinforced - Shadow
    I was thinking about making a thread about this when I too noticed some blurring.

    I use the SMAA injector in as much games as I can.

    The screenshots speak for themselves.
  • Skyforger2Skyforger2 Join Date: 2007-10-19 Member: 62681Members
    Am i only one noticing no difference in screenshots.
  • MiniH0wieMiniH0wie Join Date: 2007-11-25 Member: 63013Members
    <!--quoteo(post=1991262:date=Oct 14 2012, 11:35 AM:name=Skyforger2)--><div class='quotetop'>QUOTE (Skyforger2 @ Oct 14 2012, 11:35 AM) <a href="index.php?act=findpost&pid=1991262"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Am i only one noticing no difference in screenshots.<!--QuoteEnd--></div><!--QuoteEEnd-->

    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.
  • SkieSkie Skulk Progenitor Join Date: 2003-10-18 Member: 21766Members, NS2 Playtester, Reinforced - Shadow
    I don't use AA at all because I need the fps.
    But out of those screenies, I do feel like the FXAA looks better than SMAA...
  • XariusXarius Join Date: 2003-12-21 Member: 24630Members, Reinforced - Supporter
    I don't notice any difference, lol
  • IeptBarakatIeptBarakat The most difficult name to speak ingame. Join Date: 2009-07-10 Member: 68107Members, Constellation, NS2 Playtester, Squad Five Blue, NS2 Map Tester, Reinforced - Diamond, Reinforced - Shadow
    edited October 2012
    The most notable thing I see is the hologram esque edges are less jaggy.
  • Zomb3hZomb3h Join Date: 2011-01-27 Member: 79241Members, Reinforced - Shadow
    edited October 2012
    You guys are so blind LOL
    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.
  • Dictator93Dictator93 Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
    edited October 2012
    Comparison .gif

    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
  • peregrinusperegrinus Join Date: 2010-07-16 Member: 72445Members
    Interesting OP.

    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.
  • MiniH0wieMiniH0wie Join Date: 2007-11-25 Member: 63013Members
    <!--quoteo(post=1991274:date=Oct 14 2012, 11:46 AM:name=Zomb3h)--><div class='quotetop'>QUOTE (Zomb3h @ Oct 14 2012, 11:46 AM) <a href="index.php?act=findpost&pid=1991274"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->You guys are so blind LOL
    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.
  • Soylent_greenSoylent_green Join Date: 2002-12-20 Member: 11220Members, Reinforced - Shadow
    The hologram looks better, at least in a still shot, and less aliased with FXAA. The slight bluring is neither here nor there when actually playing, as long as you're not playing on a very low resolution.
  • SixtyWattManSixtyWattMan Join Date: 2004-09-05 Member: 31404Members
    <!--quoteo(post=1991310:date=Oct 14 2012, 12:52 PM:name=Soylent_green)--><div class='quotetop'>QUOTE (Soylent_green @ Oct 14 2012, 12:52 PM) <a href="index.php?act=findpost&pid=1991310"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->The hologram looks better, at least in a still shot, and less aliased with FXAA. The slight bluring is neither here nor there when actually playing, as long as you're not playing on a very low resolution.<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • Dictator93Dictator93 Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
    edited October 2012
    <!--quoteo(post=1991325:date=Oct 14 2012, 01:27 PM:name=SixtyWattMan)--><div class='quotetop'>QUOTE (SixtyWattMan @ Oct 14 2012, 01:27 PM) <a href="index.php?act=findpost&pid=1991325"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->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.<!--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
  • S_BadguyS_Badguy Join Date: 2003-12-03 Member: 23925Members
    <!--coloro:#DDA0DD--><span style="color:#DDA0DD"><!--/coloro--><b>Technical documentation:</b><!--colorc--></span><!--/colorc--> <a href="http://www.iryoku.com/smaa/" target="_blank">http://www.iryoku.com/smaa/</a>
    <!--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.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    As you might imagine, we are pretty busy around here, so we don't have time to explore other AA methods at the moment.

    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.
  • TechercizerTechercizer 7th Player Join Date: 2011-06-11 Member: 103832Members
    edited October 2012
    Bam. We should make this happen.

    By we, I mean the rest of you guys, because I don't think I should be messing around with rendering files :3
  • XariusXarius Join Date: 2003-12-21 Member: 24630Members, Reinforced - Supporter
    Oh, so I guess this also means we can have other graphic mods like the ones they made for GTA and BF 3, with better quality textures and stuff.
  • Dictator93Dictator93 Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
    <!--quoteo(post=1992007:date=Oct 15 2012, 06:01 PM:name=Max)--><div class='quotetop'>QUOTE (Max @ Oct 15 2012, 06:01 PM) <a href="index.php?act=findpost&pid=1992007"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->As you might imagine, we are pretty busy around here, so we don't have time to explore other AA methods at the moment.

    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!
  • S_BadguyS_Badguy Join Date: 2003-12-03 Member: 23925Members
    <!--quoteo(post=1992033:date=Oct 15 2012, 07:58 PM:name=Dictator93)--><div class='quotetop'>QUOTE (Dictator93 @ Oct 15 2012, 07:58 PM) <a href="index.php?act=findpost&pid=1992033"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Max, I really appreciate the reply. Knowing this I shall got to work. Let us see what I can do!<!--QuoteEnd--></div><!--QuoteEEnd-->
    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?).
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    I genuinely feel like I'm being trolled here. I see absolutely no noticeable difference, even in the .gif . Then again, I haven't been able to use anti aliasing since half life 1.
  • MaxMax Technical Director, Unknown Worlds Entertainment Join Date: 2002-03-15 Member: 318Super Administrators, Retired Developer, NS1 Playtester, Forum Moderators, NS2 Developer, Constellation, Subnautica Developer, Pistachionauts, Future Perfect Developer
    <!--quoteo(post=1992018:date=Oct 15 2012, 04:28 PM:name=Xarius)--><div class='quotetop'>QUOTE (Xarius @ Oct 15 2012, 04:28 PM) <a href="index.php?act=findpost&pid=1992018"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Oh, so I guess this also means we can have other graphic mods like the ones they made for GTA and BF 3, with better quality textures and stuff.<!--QuoteEnd--></div><!--QuoteEEnd-->
    icenhancer for GTA was actually one of the inspirations for making is modable.
  • Dictator93Dictator93 Join Date: 2008-12-21 Member: 65833Members, Reinforced - Shadow
    First SMAA, then Ill attempt any other additions I can think of. Some are a lot more involved than SMAA
  • AsranielAsraniel Join Date: 2002-06-03 Member: 724Members, Playtest Lead, Forum Moderators, NS2 Playtester, Squad Five Blue, Reinforced - Shadow, WC 2013 - Shadow, Subnautica Playtester, Retired Community Developer
    Sounds great! looking forward to it :)
  • S_BadguyS_Badguy Join Date: 2003-12-03 Member: 23925Members
    <!--quoteo(post=1992130:date=Oct 16 2012, 01:00 AM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ Oct 16 2012, 01:00 AM) <a href="index.php?act=findpost&pid=1992130"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->I genuinely feel like I'm being trolled here. I see absolutely no noticeable difference, even in the .gif . Then again, I haven't been able to use anti aliasing since half life 1.<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • LudiKalellLudiKalell Join Date: 2003-12-14 Member: 24376Members
    edited October 2012
    The video above shows it all.. it shows exactly how SMAA is so superior to the other AA modes.

    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.
  • LudiKalellLudiKalell Join Date: 2003-12-14 Member: 24376Members
    Just as I looked at one of my favorite technical videos (the above one), I found this one: a bit OT (well, It's the author of SMAA), but still: <a href="http://vimeo.com/36048029" target="_blank">http://vimeo.com/36048029</a>

    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..
  • sushia11sushia11 Join Date: 2012-10-12 Member: 162112Members
    <!--quoteo(post=1992522:date=Oct 16 2012, 01:06 PM:name=S_Badguy)--><div class='quotetop'>QUOTE (S_Badguy @ Oct 16 2012, 01:06 PM) <a href="index.php?act=findpost&pid=1992522"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->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.<!--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
  • ImbalanxdImbalanxd Join Date: 2011-06-15 Member: 104581Members
    Watched that video, feel like I'm being trolled even harder now. Still unable to see any difference between any of those modes.
  • RegnarebRegnareb Join Date: 2007-08-26 Member: 62008Members, NS2 Playtester
    <!--quoteo(post=1992663:date=Oct 17 2012, 06:50 AM:name=Imbalanxd)--><div class='quotetop'>QUOTE (Imbalanxd @ Oct 17 2012, 06:50 AM) <a href="index.php?act=findpost&pid=1992663"><{POST_SNAPBACK}></a></div><div class='quotemain'><!--quotec-->Watched that video, feel like I'm being trolled even harder now. Still unable to see any difference between any of those modes.<!--QuoteEnd--></div><!--QuoteEEnd-->
    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.
  • LudiKalellLudiKalell Join Date: 2003-12-14 Member: 24376Members
    just get the fullHD offline version. If you still can't see a difference in the scenes where the rotating grid texture is compared.. well.. what did you drink today? :-)
Sign In or Register to comment.