Search Unity

Anti-Aliasing solution while using HDRP? -> 2021.2

Discussion in 'High Definition Render Pipeline' started by mick129, Jan 18, 2022.

  1. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I am getting lost on this.
    My personal game is about to be released in testing, on the other hand, I am also working on another huge project that is currently in testing, and in both cases, we are stuck on something.

    TAA seems to be the only solution available when you use deferred rendering but it is extremely blurry.
    TAA, MSAA is for forward rendering only.
    I have tested a few assets that claimed to help with the insane blur (Beautify and CTAA) and to be honest, they helped a bit. The result has gone from terrible, to bad (I call that progress).
    So I am asking here as around me and on my research, I have never been able to find a solution to this. Is it possible to have a good anti-aliasing solution that is not blurry at the same time?
     
  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    TAA should not be that blurry with the sharpening it has, you can increase the sharpening properties as well.
    Also, don't use "high" setting - use medium. Most of the time it's better than high.
    Make sure motion blur is off by the way, sometimes one might forget and confuse it for TAA blur

    One problem is if your grass/terrain uses instancing (which it probably does) in that case it will not have motion vectors.
    So it will be extra blurry on movement (wind & ).

    Not much you can do about that.
    Although in 2021.2 you can reduce blending a little, and play with the sharpening properties until you find a good fit. The stronger the wind, the worse it'll be -- so unless necessary keep the wind low.

    why only TAA? FXAA and SMAA also work on deferred rendering.

    Maybe use the motion vector debugger as well to make sure any meshes you have contribute camera & object motion vectors correctly (houses, buildings, etc)
     
    Last edited: Jan 19, 2022
  3. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Indeed I was using TAA at high, as for MSAA and FXAA I tried to activate them and really had no result at all, maybe I am missing something simple?

    Also as for the vegetation and the grass, this is indeed my biggest problem.
     
  4. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    MSAA won't work on deferred as you mentioned, but SMAA and FXAA should, at least they did for me unless my memory is failing me.

    SMAA sometimes gives weird errors on console when you activate it, but it works as well.


    I know that TAA doc mentions high doesn't mean better quality, but it is consistently (near always) worse than medium.
    Especially if you some objects don't have motion vectors.

    Really feels wrong, as most people, especially players will put it on high thinking it's the best visuals.
    Maybe it's quality can be improved further.

    Also some helpful properties/options are not possible in medium, I wonder if it's possible to have them added to it, or maybe they rely on the difference in algo with the high setting.
     
    mick129 likes this.
  5. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Thank you for your feedback, I stopped trying with the other solutions thinking it was exclusive to forward, so starting from here I will try the other solution and find what is best for us.
     
    PutridEx likes this.
  6. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    Honeslty? No.
    My gut feeling tells me that there is something going on with Unity's Motion Vectors. It breaks randomly mid game...and just comes back. Unity devs seem to be not even aware of this. TAA will just start doing its powder magic randomly...sometimes not, but sometimes yes. My feeling is that it is related DX11 vsync/screenmode still being buggy and every framerate related things start to go off. But this is my theory.

    It has been like this since Day 1, not that Unity's TAA is particularly bad, but most games that use TAA add in some custom masking or functions to cover up some of the artefacts. Unity hasn't tried that and it just hurts more.

    Also, unity's bad gc collection and lag spikes make things worse, making artefacts more noticable even at higher frame rates...Imagine 140fps with working motion vectors...even the crappiest TAA would show very little ghosting...as opposed to 60FPS

    I've given up on Unity TAA and have moved onto DLSS. It is just better...but Unity apparently is still deciding if the new DLSS 2.3 is worth implementing...so I rest my case...the one way to render something good in Unity and they are still deciding if it is worth updating...phew.
     
    mick129 likes this.
  7. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I wish I could stick to DLSS but only Nvidia users will be able to benefit from this and I would like to stick to solution that could benefit everyone.
     
  8. jjejj87

    jjejj87

    Joined:
    Feb 2, 2013
    Posts:
    1,117
    I want the same thing...but there is what we want and then reality.

    DLSS users can get to have good render and rest will have to stick to FSR + TAA or Unity's TAA upscale...I wonder how the new one fares against FSR...
     
    mick129 likes this.
  9. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    202
    Wait, cant we just disable TAA for certain objects? (I guess disabling motion vectors wouldn't count since it would produce ghosting)
     
  10. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    I don't think you can do that.
     
  11. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    I don't think we can but I'm curious to know if it is possible.
     
  12. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    - If your game has a fixed camera perspective that isn't showing a big part of the game (isometric, top down, etc) one idea is to actually have all your grass as meshes, since only a few meshes will be visible at any given time, culling should remove the others. And maybe merge some of the meshes to reduce drawcalls, but not too much and only grass next to each other to keep culling effective. That type of merging is possible with Mesh Studio on the asset store (cell based combining meshes) This way all your grass will have motion vectors. Maybe same thing with trees.

    Although I'm not sure if that's really a viable way of doing it, just throwing ideas.
    I'm not sure how you'd extract all the grass placed with terrain as meshes, otherwise you'd have to re-do it all.

    on TAA -

    TAA high:


    TAA medium:

    As you can see TAA high is better at retaining the small details on the plant from a distance.
    I also notice on some projects it might have less flickering than medium.

    So it's not all bad -- The most problematic thing maybe is if your doing open world with large amounts of grass/trees, high quality suffers more than medium if an object doesn't have motion vectors. More ghosting/blurriness compared to medium.

    But if your project has motion vectors everywhere, high is worth testing as it might give better visuals.

    The problem with SMAA and FXAA (even MSAA) is they don't help with specular aliasing. So when your moving your camera, things will flicker a lot, it's not smooth or consistent. This is especially the case for PBR. TAA makes things like vegetation a lot nicer visually as well.

    Anti-aliasing imo is one of the most important visual parts of an engine since it'll completely change the final image quality. Aliasing just ruins visuals completely for me.

    DLSS is awesome but most people don't have an RTX card, so it can't be seen as a main/uniform solution if you're releasing your project to the public.
    This is where TAA is still the best at.


    If there's an issue with motion vectors in HDRP, I hope it gets solved since it's critical for many things. But I don't really know if it exists or not, never noticed the issue myself.
    Although it's probably hard to notice without tests.
     
    Last edited: Jan 19, 2022
    mick129 likes this.
  13. mick129

    mick129

    Joined:
    Jun 19, 2013
    Posts:
    228
    Well I'm actually working on a topDown open world game and for another TopDown game (not open world). I already combine small chunks of grass/plants to use them via VSP bit I never tough about using a tool like Mesh Combine Studio 2 and then combine the meshes async and not use GPU Instancing at all.
    I will do some tests today if I have the time!
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    You have to isolate if your aliasing is coming from textures (proper filtering of normal and smoothness maps will fix it), small triangles (geometry antialiasing will help there) or just edges.

    TAA won't help some issues while it will help others, and there is much you can do for the geometry and texture cases. Which I suspect are your real problems.
     
    mick129 likes this.
  15. Enigma229

    Enigma229

    Joined:
    Aug 6, 2019
    Posts:
    135
    TAA isn't a good solution in my opinion. I use it for motion blur in my cinematics and it takes too long to play around with the settings to get good results. Even the AOV image sequences I render out are useless because everything is too darn aliased.

    I sometimes use an offline renderer called V-Ray in Maya and all you do it click the motion blur checkbox and it works.
     
    mick129 likes this.
  16. merpheus

    merpheus

    Joined:
    Mar 5, 2013
    Posts:
    202
    like unity doesnt allow it, so we cant do that or technically cant do that? I think technically this should be possible and simple. As long as there is a separate TAA mask that Gbuffer outputs, it can be used in TAA pass to not blend with masked parts.
     
  17. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Unity doesn't allow it (more like didn't implement it), as in there's no easy way exposed to users for it.
    Not that you can't do it technically.
     
  18. Wolfos

    Wolfos

    Joined:
    Mar 17, 2011
    Posts:
    951
    DLSS is the best anti aliasing solution we have right now. TAA should be a fallback. That said - it shouldn't be blurry.
     
    mick129 likes this.