Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

URP Camera Stack and Anti-Aliasing

Discussion in 'Universal Render Pipeline' started by Elfstone, Apr 22, 2020.

  1. Elfstone

    Elfstone

    Joined:
    Apr 13, 2015
    Posts:
    26
    A brief temporary summary:

    The fact FXAA affects all cameras including ones on the camera stack and SMAA only affects the base one, makes it a poor choice to put them together for users to choose from.
    I personally would consider this a bug.

    ----------------------------------------------------- Original Post --------------------------------------------

    I've been using a separate Screen Space Camera for my UI canvas. Now that I'm trying to migrate to URP, I understand that I need to add the UI camera to the base camera's Stack for it to be rendered.
    But the result is wrong due to anti-aliasing (FXAA) applied after everything.
    So, is it possible to skip AA for the overlay cameras? Or am I doing it wrong adding a UI camera to the camera stack?

    Plus I find it weird assigning a ForwardRenderer to the UI Camera.
     
    Last edited: Apr 22, 2020
    owen_proto likes this.
  2. Elfstone

    Elfstone

    Joined:
    Apr 13, 2015
    Posts:
    26
    Last edited: Apr 22, 2020
  3. Elfstone

    Elfstone

    Joined:
    Apr 13, 2015
    Posts:
    26
    After digging into the source a little I feel like understanding why it's not obvious there should be a switch for skipping AA. But doesn't it look like a lot of people will be needing such a switch? I want to use multiple cameras but I only want the first of them AAed. I guess I'll have to render the overlays on separate textures and blit them AfterRendering + 2?
     
  4. Elfstone

    Elfstone

    Joined:
    Apr 13, 2015
    Posts:
    26
    SMAA happens a lot earlier and therefore won't affect overlay cameras!
    Seriously, even just for the sake of consistency, FXAA shouldn't affect overlays either, or they don't belong together on one drop-down list.
     
    AnomalusUndrdog likes this.
  5. jsjdev91

    jsjdev91

    Joined:
    Dec 17, 2019
    Posts:
    4
    I'm experiencing the same thing. SMAA is applied after the base camera, and FXAA is applied after each of the overlays. I agree with the OP that this is considered a bug since it's not consistent. Would be curious to know if there's a way to control this as I'm in the camp that wants AA to be applied after all overlays (depth buffer seems to be cleared after SMAA applied on base but I need to access it for an overlay camera). Whereas the OP seems to want it to be applied to the base camera only.
     
    carlemilk likes this.
  6. SplenShepard

    SplenShepard

    Joined:
    Aug 24, 2019
    Posts:
    16
    Bump. I'm having this issue as the FXAA affects text mesh pro and I have my 3d camera and UI camera on the same stack. I want FXAA to affect the 3d camera only, but the AA settings only exist on the base camera
     
  7. weiping-toh

    weiping-toh

    Joined:
    Sep 8, 2015
    Posts:
    186
    I had similar problems with different camera configurations (stacking UI from different space). After messing around with the initial camera stacking feature provided. I simply gave up and concluded that it is faster that I implemented my own custom ScriptableRenderers that do what I want for each different cameras and have them output to a temporary RenderTexture which gets collected by the "master" camera with the default ForwardRenderer via a custom RenderFeature.

    It was such a pain to realise that having different viewports is not supported by the packaged camera stacking feature.
     
  8. Carrmichaelll

    Carrmichaelll

    Joined:
    Nov 30, 2016
    Posts:
    68
    This is really annoying
     
  9. GoGoGadget

    GoGoGadget

    Joined:
    Sep 23, 2013
    Posts:
    855
    Crazy that Unity does this but you are right, it is just an issue that they obviously never foresaw when implementing FXAA. Just did a quick check of my own assets AA (DLAA), and it works perfectly when stacking cameras, not affecting the world-space UI camera in this instance. Quick little comparison here: https://imgur.com/a/RWvPNFr
     
    PutridEx likes this.
  10. Zilk

    Zilk

    Joined:
    May 10, 2014
    Posts:
    329
    Yeah this really sucks. For mobile I'd prefer to run FXAA and SMAA on PC/consoles. But since FXAA messes up TMPro fonts that's no really an option. This setting should be per camera or at least off by default on stacking cameras for both FXAA and SMAA.
     
  11. owen_proto

    owen_proto

    Joined:
    Mar 18, 2018
    Posts:
    118
    i just wanted to pile on here to say this AA situation is confusing and inconvenient. my main issue with it is also that FXAA destroys textmeshpro rendering.