Search Unity

Antialiasing in Unity 5

Discussion in 'General Graphics' started by Stormbreaker, Jul 11, 2014.

  1. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    This is a quick question for the graphics devs. As Unity 5 is switching over to a fully deferred renderer, MSAA in its traditional form will no longer work (a problem all deferred engines have had to face). Some engines (Frostbite comes to mind) have found ways of getting deferred MSAA into the engine. So how has this problem been addressed (if it has at all)?

    The postprocessing anti-aliasing in Unity 4 is horrible, especially FXAA. It's one of the largest pitfalls of using deferred over forward rendering in my mind. The best solution seems to be a user made SMAA shader, which smoothens out the edges with minimal blurring, however it is not well optimised and is fairly demanding to use. Will Unity 5 contain deferred MSAA, SMAA, or any improvements to antialiasing in general?

    I hope so, good AA really makes a difference. My fingers are crossed :D
     
  2. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    I echo your concerns, hopefully we can get an official response on this point.
     
  3. SpreadcampShay

    SpreadcampShay

    Joined:
    Dec 9, 2010
    Posts:
    180
    I consider improvements in that area essential for the new graphic features, and hope we hear something positive soon.
     
  4. Deleted User

    Deleted User

    Guest

    I've been saying this for goodness how long? Temporal AA with it's shiny cinematic post looks amaziiing!..
     
  5. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    Glad to see other people are concerned. Hopefully Aras or someone will give us a nice surprise :D
     
  6. jcarpay

    jcarpay

    Joined:
    Aug 15, 2008
    Posts:
    561
    Yeah, we definitely need epic (pun intended) AA!
     
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    There's already a bunch of post fx AA in Unity right now. FXAA etc. And these won't suddenly stop getting used in PS4 and xbox one titles. FXAA is just really fast and decent. It's not something you replace unless you're targeting high end desktop tbh.

    TXAA and all that's very well and good, but still not realistic for most retail games out of the box (but as an option, it's very nice) :)
     
  8. Deleted User

    Deleted User

    Guest

    CryEngine gets away with deferred rendering and MSAA and Hybrid SMAA with decent post and you don't get nowhere near the amount of aliasing issues, plus check out the grass :D:

     
    Developer007 likes this.
  9. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    ECHOING. official devs, where are you?
     
  10. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    But the majority of us aren't developing for consoles, where people are seated metres away from the screen and the blurring isn't noticeable, we're talking about inches for PC. Do a search on almost any forum for a popular video game (i.e. Crysis or Skyrim) for a thread about the antialiasing options, and there's usually a large number of gamers posting about their dislike for FXAA. It's great as a backup for low end hardware when a better algorithm or real AA isn't an option, but not for a lot of gamers who want the game to look crisp, clear, and beautiful.

    EDIT: Just did some research, it looks like UE4 only has postprocessing AA for now, which doesn't bode well for us. Frostbite 2+ appears to use a postprocessing technique called SRAA (https://research.nvidia.com/sites/default/files/publications/I3D11.pdf), I wonder if it will be possible to implement into Unity?
     
    Last edited: Jul 11, 2014
  11. SememeS

    SememeS

    Joined:
    Nov 27, 2012
    Posts:
    127
    These guys made a SMAA solution for Unity, works much nicer than any of the current Unity AA, I been using it since I found it:

    https://github.com/Chman/uSMAA


    I'm also hoping Unity5 will have some better AA solutions.
     
    Last edited: Jul 12, 2014
  12. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
  13. Ferazel

    Ferazel

    Joined:
    Apr 18, 2010
    Posts:
    517
    I know this was probably meant to be sarcastic, but I kind of agree with the sentiment. Hopefully, soon we will render our products on screens that actually represent images better instead of trying to compensate with hacky edge detection image effects to blur edges. Running AA on 300+ PPI screens hardly seems necessary.
     
  14. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    Thanks for the article, that was an awesome read. Seems like a combination of SRAA and a good post process shader like SMAA or MLAA is the way to go with a deferred engine. Hopefully Unity will be able to get these in at some point, if not in the 5.0 release.
     
  15. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Depends; on iPhone and similar screens AA is still clearly necessary. If the screen is across the room from you, then maybe not.

    --Eric
     
  16. Developer007

    Developer007

    Joined:
    Jul 8, 2014
    Posts:
    31
    wow , but how really grass moves when player walk ? i see that in assassins creed
     
  17. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    8,194
    On a side note it looks like 4k gaming's biggest problem is how well the GUI scales link
     
  18. Velo222

    Velo222

    Joined:
    Apr 29, 2012
    Posts:
    1,437

    Making "foliage" move when a character walks through it can actually be done right now in Unity. Check out the "Advanced Foliage" asset on the asset store by Lars. I can't remember the name exactly. It might not be quite as good as seen in that video, but it's close to it.

    Basically using physics detection and shaders.
     
    Developer007 likes this.
  19. xCyborg

    xCyborg

    Joined:
    Oct 4, 2010
    Posts:
    633
    I didn't know forward rendering mode is discontinued in Unity 5, I think there are still many situations when we need it.
    That being said, aliasing is a huge elephant in the dev garage for me, I have to render 3d geometry in MODO and retouch in PS instead of importing directly in Unity because of the broad difference in quality between realtime in Unity and pre-rendered, and that being in forward mode AND with FXAA script. so deffered mode is out of the question for now until maybe we get some AA love from Unity.
     
  20. Deleted User

    Deleted User

    Guest

    Neither did I, how are they going to deal with transparency I wonder?
     
  21. Brenden-Frank

    Brenden-Frank

    Joined:
    Aug 5, 2012
    Posts:
    110
    Got a source on that? I find it hard to believe they would discontinue forward rendering.
     
    Deleted User likes this.
  22. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    No one said forward rendering is being discontinued, they've said it will remain in the engine to be used as a backup in case Unity runs on hardware which doesn't support deferred, so the primary rendering path will be the fully deferred renderer instead of the hybrid they use now.
     
  23. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    A lot of these posts misses the point.

    Post process AA is not a 'solution', it is at best a patch job. Methods like FXAA were developed for the older generation of consoles that don't have the power to supersample.

    At the very least, for Windows, Mac, Linux and WebGL builds, should be able to support FSAA techniques, regardless of rendering pipeline.

    If Unity 5 ships with no support for proper FSAA on it's Deferred pipeline, it will be left behind.
     
    Deleted User likes this.
  24. bluescrn

    bluescrn

    Joined:
    Feb 25, 2013
    Posts:
    642
    Deferred isn't going to be viable on mobile any time soon (maybe on very-very-high-end devices, but not in a real-world game which needs to support at least the iPhone 4S and popular mid-range Android devices)
     
  25. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    I've poked people to look at this.

    soon.jpg
     
    3agle and Deleted User like this.
  26. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    Thanks Aurore :) Will be good to hear what the devs have to say about it.
     
  27. Deleted User

    Deleted User

    Guest

    Ummm I can't even fathom how you brought Modo into this? We are talking about DR and anti-aliasing in Unity 5??!

    Normally in an engine for transparency you use Multipass when using deferred rendering, cut forward rendering and you run into the same issues they had with TDR in UE4, here have fun:

    http://www.john-chapman.net/content.php?id=13
     
    Last edited by a moderator: Jul 14, 2014
  28. Kaspar-Daugaard

    Kaspar-Daugaard

    Unity Technologies

    Joined:
    Jan 3, 2011
    Posts:
    150
    Just to clarify, we are not switching to a fully deferred renderer, it comes in addition to the rendering paths we already support. I hope that relieves some of your concerns. I am not sure what the state of deferred and antialiasing will be when we ship, but most likely you will need to use a postprocessing filter like FXAA.

    Fully deferred plus MSAA is something that would be really nice to support, but is quite slow if you have to do lighting separately for each sample. We'll think about how best to do it. It's not something you typically want to use because of the memory cost, but if you have the hardware for it, I think we should allow it.
     
  29. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    Thanks for the reply Kaspar, great to hear that you're looking into it. Does this mean there will be 4 rendering paths then (Forward, deferred hybrid, fully deferred, and vertex lit)? What benefits does a fully deferred system bring to the table?
     
  30. Kaspar-Daugaard

    Kaspar-Daugaard

    Unity Technologies

    Joined:
    Jan 3, 2011
    Posts:
    150
    Yes, we will keep both types of deferred rendering, and probably name the hybrid one "legacy deferred".

    The benefit of fully deferred is that you only have to render the scene geometry once. The hybrid approach has to render the geometry first as depth and normals for the lighting and then again for the final shading. It gives a bit more flexibility but is also more expensive.
     
  31. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    any news on implementing TXAA or any better AA solution?
     
  32. elmar1028

    elmar1028

    Joined:
    Nov 21, 2013
    Posts:
    2,359
    Bumping in 10 minutes? Really?
     
  33. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    I thought i deleted the last post :)
     
  34. TheSniperFan

    TheSniperFan

    Joined:
    Jul 18, 2013
    Posts:
    712
    Don't wait for it.
    Even current smartphones with their HDPI screens require AA. Nowhere gets this more clear, then when you turn off the 2d AA algorithms that are being used for the UI. Fonts start looking absolutely awful.

    It has to do with the complexity of curves. While screens can only display perfectly vertical or horizontal lines properly, your content can have lines of any angle. You need to compensate for this.

    It also depends on the distance. A +300 ppi TV on the far side of your room would probably suffice. For desktops, laptops, smartphones and tablets, you'll need far more.

    I don't have the numbers anymore, but I think it was like a 10 or 100 times higher pixel density for smarphones before we could turn off font smoothing.
    That's not going to happen anytime soon (if at all - I mean, you can't [physically] shrink components forever).

    Downsampling is probably your best bet.
     
  35. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Supersampling is of course the best but also the most expensive option.

    I would like to see more information about the difference between the new/old deferred rendering methods!
    Whats the difference in quality, speed and other aspects. Interesting stuff.
     
    Last edited: Oct 13, 2014
  36. superpig

    superpig

    Drink more water! Unity Technologies

    Joined:
    Jan 16, 2011
    Posts:
    4,657
    You mean supersampling?
     
  37. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    Of course i meant that : p
     
  38. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    if anyone is ready to implement TXAA for Unity Pro [Windows] i would pay any amount of money they ask, that's how much we need it.
     
  39. TylerPerry

    TylerPerry

    Joined:
    May 29, 2011
    Posts:
    5,577
    Have you tried SMAA? Haven't used the Unity implementation much but in other places it seems to give the best results for the cost.
     
    shkar-noori likes this.
  40. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    TXAA is only supported on Nvidias GPUs right? That means you will shut out a big part of your customers?
     
    shkar-noori likes this.
  41. imaginaryhuman

    imaginaryhuman

    Joined:
    Mar 21, 2010
    Posts:
    5,834
    I guess MSAA could be faked by rendering to some high-res render texture bigger than the screen, then scaling that down with bilinear filtering or something... .msaa is basically multi-sample ie basically drawing a much higher-res picture and then figuring out how to represent multiple pixels in 1 pixel.
     
  42. 3agle

    3agle

    Joined:
    Jul 9, 2012
    Posts:
    508
    That's called downsampling, and isn't technically antialiasing (it just prevents aliasing from appearing in the first place(and even then not always)).

    MSAA is different as it still renders the same number of pixels, it just samples each one multiple times.
    This is better than downsampling as you don't have the huge overhead of rendering all those extra pixels and whatnot.
     
  43. Roni92

    Roni92

    Joined:
    Nov 29, 2013
    Posts:
    225
    What is interesting enough, I was looking for ANY post fx AA in asset store... and found nothing. I mean... how its possible? Many post fx packages, but NOONE has AA ! wow! And forward rendering AA looks soo much better than post AA included in examples post fx, that I prefer to use forward rendering instead of deferred.. yeah, just because of AA.
     
  44. Aras

    Aras

    Unity Technologies

    Joined:
    Nov 7, 2005
    Posts:
    4,770
    That's not what MSAA does, actually. MSAA effectively samples pixels multiple times on the triangle edges. Inside of the triangles nothing changes (so you can still get shader aliasing etc.).
     
  45. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833
    no, but the big part of our customer base are using nVidia GPUs and are asking for TXAA. we have SMAA [user created], and the FXAA's,
     
  46. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    TXAA is all fine and good but really, I'm more interested in seeing a way to combine most of these post fx to get the pass count down. These can all add up. For instance perhaps edge detection is needed in 2 places, so an intelligent post fx method would reuse this data or even combine it with another effect.

    Speed will always end up making your game look better than latest next-gen-fizzle-bang-technique X
     
    Deleted User likes this.
  47. virror

    virror

    Joined:
    Feb 3, 2012
    Posts:
    2,963
    TXAA implementation is not publicly available, so you need to contact Nvidia directly for that, and its probably quite tricky to add without access to the engine i can imagine. Unity wont add it because its a company exclusive thing : /
     
  48. Stormbreaker

    Stormbreaker

    Joined:
    Aug 15, 2012
    Posts:
    161
    The new MFAA technique by nVidia looks awesome, shame it's only available on 900+ series graphics cards. Can't believe it's 2014 and we still can't render a fricken line smoothly o_O
     
  49. 0tacun

    0tacun

    Joined:
    Jun 23, 2013
    Posts:
    245
    Could Unity not roll their own TXAA solution?

    http://bartwronski.com/2014/03/15/temporal-supersampling-and-antialiasing/

    I think TXAA is a very good solution, it is very crucial, espacially when using in conjunction with the new pbr lighting system because it lets the details shine.
     
    shkar-noori likes this.
  50. shkar-noori

    shkar-noori

    Joined:
    Jun 10, 2013
    Posts:
    833

    Enlighten is like that too, right?
     
    Last edited: Oct 13, 2014