Search Unity

  1. Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Quest + LWRP/URP: MSAA not working

Discussion in 'AR/VR (XR) Discussion' started by DanjelRicci, Nov 30, 2019.

  1. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Pretty much as the title says, I'm using Unity 2019.2.14f1, Oculus Integration 1.43, LWRP 6.9.1.
    Setting MSAA in the LWRP settings to any value (2x, 4x, 8x) does nothing. All cameras have MSAA set to Use Pipeline Settings. OVRManager has Use Recommended MSAA set to false. I'm not using any PostProcessing package. What am I missing?

    EDIT: not totally working either on 2019.3.0f3 + URP, see later replies.
     
    Last edited: Dec 16, 2019
  2. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    606
    MSAA is currently unsupported in LWRP in VR.
     
    ROBYER1 likes this.
  3. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    So there is no way of having antialiasing with LWRP and VR? MSAA is the only antialiasing option available as far as I can tell, when using LWRP.
     
  4. nomand

    nomand

    Joined:
    Dec 23, 2008
    Posts:
    44
    Strange, I've used it with LWRP and now with URP in exactly that way, camera set to use pipeline, ovrmanager to false, URP asset set to 8x, works fine. Check that the camera you're rendering from is tagged Main Camera, make sure your render pipeline asset is also set in Quality project settings under Rendering (not just Graphics Settings) although I doubt it should matter.
     
  5. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    606
    I used this trick for a bit then it stopped working on some update. It's hard to know which versions are compatible with each other... out of interest which LWRP / Unity / OVR version mix are you getting this to work with?
     
  6. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    I had set everything exactly like that, it just won’t work. Actually not even Post Processing antialiasing is working... I’m left with no choice to revert to default pipeline then? It escapes me why we should even use LWRP in VR if no form of antialiasing is working.
    Unless this depends on the stereo rendering mode? I’m using Single Pass now.
    EDIT sorry, I'm using Multiview. Single Pass renders the right eye deformed, and Multi Pass doesn't render the right eye at all (still in both cases AA didn't work).
     
    Last edited: Dec 3, 2019
  7. nomand

    nomand

    Joined:
    Dec 23, 2008
    Posts:
    44
    My current setup with MSAA working:
    Unity 2019.3.0f1
    URP 7.1.6
    Relevant URP settings:
    Depth texture on
    HDR off
    MSAA 4x
    Render Scale 1
    Main Light per pixel, Cast shadows on, 1024 res with no additional lights.

    Not using OVRManager:
    Tracked Pose Driver on a camera with settings:
    Renderer set to URP_Renderer in the dropdown
    Opaque + Depth texture "Use Pipeline"
    HDR, MSAA "Use Pipeline"

    If using OVRManager:
    Use Recommended MSAA off.
    Same camera settings as above.
     
  8. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Thanks a lot. I'd like to avoid updating to 2019.3 and to URP in this moment because I've already spent a lot of time trying to get things working rather than working on the actual game... I guess I'll do it later. I had all sorts of issues with Quest and 2019.3 beta previously, might need to check again what changed for the final release.
     
  9. nomand

    nomand

    Joined:
    Dec 23, 2008
    Posts:
    44
    I wouldn't recommend it yet, both multiview and multipass are broken, but MSAA is definitely working. I was using exactly the same setup in 19.2.12 LWRP before porting to URP, and it worked then too.
     
  10. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    606
    ahh... must be a 2019.1 problem
     
  11. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Oh god, I've just noticed I mistyped the very first post and didn't precisely specify what version I was using... Fixed it now. My version, where AA is not working, is 2019.2.14f.
     
  12. mpgholden

    mpgholden

    Joined:
    Aug 21, 2014
    Posts:
    30
    I am running into this bug with URP 7.1.6 and Unity 2019.3.0f1 as well. MSAA was working for me in previous versions of the LWRP on 2019.2. Submitted it as bug 1204783.

    I noticed that after upgrading to the current URP and Unity versions, the camera was creating a depth texture in builds even though we had depth texture turned off in the URP settings. I edited ForwardRenderer.cs to force it to skip the depth and intermediate textures, and found that XR.XRSettings.eyeTextureDesc.msaaSamples is always "1" even after changing antialiasing settings, forcing QualitySettings.antiAliasing to higher values and calling XR.XRDevice.UpdateEyeTextureMSAASetting, etc.
     
    DanjelRicci likes this.
  13. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Still no sign of working in 2019.2.16f. Really isnt' there any solution to this? It was working properly with early 2019.2 versions. Can we at least have a sign from the Unity team?
     
  14. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Well, managed to update and get my game working on 2019.3.0f3, with the same identical settings as below, and antialiasing is still not working on Quest. There must be some other undocumented options that influence this, it can't randomly decide to just not work anymore.

     
    mpgholden likes this.
  15. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    728
    TheVirtualMunk and DanjelRicci like this.
  16. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    I managed to get some results.
    - Added VR_ENABLED flag in Scripting Define Symbols as suggested by Claytonious.
    - Enabled XR Plugin Management from Project Settings.
    - Installed the Oculus XR Plugin from the dedicated panel under XR Plugin Management.
    - Installed Input Helper 1.3.8, always from there.
    - Set Stereo Rendering Mode to Multiview (Multi Pass makes the right eye render all black).
    If I Build and Run the game, antialiasing works perfectly. If I close the game and launch it from the Oculus dashboard, antialiasing is no more.

    Note that I'm still using the original components from the official Oculus plugin I had in 2019.2 (OVRCameraRig/OVRManager). Head/hand tracking and input are still working, luckily.

    EDIT: compiled again, same settings, antialias is not working on launch. It's literally the guessing game.

    EDIT2: deleted URP package, reinstalled again without changing anything, clicked build and run, and MSAA works. Closed the game, launched it from Oculus dashboard, MSAA doesn't work anymore once again.
    What's the difference between launching the game via Unity and via system dashboard?

    EDIT3: submitted ticket number 1206060.
     
    Last edited: Dec 17, 2019
    mpgholden and ArdaZeytin like this.
  17. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    Any update on this? I am tired trying to remove the flickering edges on Quest.
     
  18. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Not yet unfortunately, waiting for replies to the ticket at the moment. I also asked in a couple of Discord servers, without luck.
     
  19. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    They have released Beta version of 2020. Maybe we can try that version to see if there are any changes.
     
  20. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    I really just hope they will fix this in 2019.3.0f4, or at least provide some workaround I can use on the current version. I'd rather not switch to a whole new major release considered the state of things now, and most likely never update again once all things work as I expect.
     
  21. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
    rc4 is out since this morning if you want to try @DanjelRicci
     
    DanjelRicci likes this.
  22. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Can't find that, neither in the Hub or in the website- it's still 2019.3.0f3. Also, is there a changelog eventually?
     
  23. Jichaels

    Jichaels

    Joined:
    Dec 27, 2018
    Posts:
    237
  24. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
  25. VRising

    VRising

    Joined:
    Apr 15, 2016
    Posts:
    29
    Were you able to solve the antialiasing issue? I'm running into it myself. Currently on 2019.3.0f3.
     
  26. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Unfortunately not. Not a single reply yet about the issue but I’d wait after the holidays for that...
     
    satchell likes this.
  27. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Well, happy new year I guess. Any news on this?
    I'm still in the situation where Build And Run enables antialias, but launching the game from Quest dashboard doesn't enable it.
     
  28. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    A workaround is available!

    I received a mail with an update for the ticked I opened (Issue number 1197958) and as you can see from the link, you can work it around by changing the eye texture resolution. I'm using the script below to achieve that.
    Thanks to Dominykas M from the QA team for helping with this!

    Code (CSharp):
    1. using System.Collections;
    2. using UnityEngine;
    3.  
    4. public class AAFix : MonoBehaviour{
    5.  
    6.     void Start() {
    7.         StartCoroutine("Fix");
    8.     }
    9.  
    10.     IEnumerator Fix() {
    11.  
    12.         UnityEngine.XR.XRSettings.eyeTextureResolutionScale = 0.5f; // Any value, just to trigger the refresh
    13.         yield return new WaitForEndOfFrame(); // Needed to apply the changes
    14.         UnityEngine.XR.XRSettings.eyeTextureResolutionScale = 1f; // Use your target resolution here
    15.         Destroy(this);
    16.     }
    17. }
    18.  
     
    TheVirtualMunk, Dance_M and mpgholden like this.
  29. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    Is MSAA working with FFR? (Fixed-Foveated Rendering)
     
  30. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    Increasing eye texture resolution scale to 1.5f or more increases the resolution of the game, hence the flickering of meshes is minimal. However it affects the performance and the game lags. Is there any other way to achieve this without making the game lag?
     
  31. DanjelRicci

    DanjelRicci

    Joined:
    Mar 8, 2010
    Posts:
    223
    Yes, it is! I just added
    OVRPlugin.fixedFoveatedRenderingLevel = OVRPlugin.FixedFoveatedRenderingLevel.Medium; at line 11.
    Sorry for the late reply, I intended to write this on the FFR issue thread too but stuff got in the way. Going to do it asap.

    Once you use that workaround to make antialiasing work, you shouldn't need to increase texture resolution (unless you want some extremely sharp detail). Antialiasing makes the game a bit blurrier at 1x resolution, but it looks much better than not having it.
     
  32. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    So is there no performance impact due to doing this? I will try this solution soon thankyou, hoping for an official Unity fix though seeing as this is so simple to workaround and fix..
     
  33. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    See my other thread here, your fix is not a fix if you have UI or a shadergraph that makes any use of Depth pass in the scene. Having either of those breaks both MSAA and FFR as well as not rendering the shader graph or UI
    https://forum.unity.com/threads/fix...-quest-not-working.686662/page-2#post-5364858
     
  34. mpgholden

    mpgholden

    Joined:
    Aug 21, 2014
    Posts:
    30
    You can manually change ForwardRenderer.cs in the URP so that it never allows an intermediate render texture, and that should allow FFR and MSAA to work (you have to render directly to the swapchain textures).
     
  35. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    What did you do to do this?
    Hoping that Unity are working on their own fix
     
  36. mpgholden

    mpgholden

    Joined:
    Aug 21, 2014
    Posts:
    30
    Force m_ActiveCameraColorAttachment and m_ActiveCameraDepthAttachment to both be the default of RenderTargetHandle.CameraTarget. Then force intermediateRenderTexture to false so that it doesn't create a camera render target.

    It's a hack, and you should wrap it in !UNITY_EDITOR tags. Agree we need a proper fix.
     
    ROBYER1 likes this.
  37. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    728
    Can confirm that this works. The URP team has responded about it a little bit in this thread.
     
  38. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
  39. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    Using Multi-view rendering makes the game laggy and using Multi-Pass rendering makes the game work smoothly but only renders on Left Eye and Right Eye remains black. Is there a fix for this?
     
  40. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    Multi-Pass is meant to be less performant than Multiview (quite drastically so), please report this issue with the Unity Bug Reporter and post the bug case number back here, I will try to chase it with you.

    https://unity3d.com/unity/qa/bug-reporting
     
  41. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    A PR for this exact issue and fix has been set up but not merged into the Master of URP/SRP on github, see it here
    https://github.com/Unity-Technologies/ScriptableRenderPipeline/pull/5671
    • The issue is that XR inits before URP overwrites MSAA settings.
    • The solution is to update XR MSAAA settings once it is changed by URP
    • Thoughts: if XR could init after URP constructor we can save this UpdateEyeTextureMSAASetting. Will need to decouple texture creation logic from XR start logic to achieve this.
     
  42. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    Could you please describe in detail about " update XR MSAAA"?
     
    ArchVizPRO likes this.
  43. saifshk17

    saifshk17

    Joined:
    Dec 4, 2016
    Posts:
    348
    URP 7.2 is available now in Unity 2019.3.0f6.
     
  44. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,390
    Do you know if 7.2 gets rid of the extra blit, or if MSAA and FFR are working out of the box now?
     
    FromTheFuture and ROBYER1 like this.
  45. ArchVizPRO

    ArchVizPRO

    Joined:
    Apr 27, 2014
    Posts:
    397
    Using Unity.XR.Oculus.Utils.SetFoveationLevel(4); give me this error:
    "Utilis" does not contain a definition for "SetFoveationLevel".
    Unity 2019.3.0f6, URP 7.2.0, Oculus XR Plugin 1.1.5
    I am missing something? Thank you
     
  46. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,138
    The new version using that isn't out *yet*
     
    ArchVizPRO likes this.
  47. Wuceng

    Wuceng

    Joined:
    Dec 18, 2018
    Posts:
    9
    7.2 Does get rid of the KILL_ALPHA blit as mentioned by a dev on a different post and tested by me. The issue that is still remaining is that using MSAA enforces a blit and thus FFR is broken still when used in combination with MSAA. Thats at least to my understanding of the current situation.
     
    ROBYER1 likes this.
  48. TheVirtualMunk

    TheVirtualMunk

    Joined:
    Sep 6, 2019
    Posts:
    50
    I'm trying to get MSAA working on the quest as well without luck.

    Unity 2019.3.1f1.

    Tried both URP 7.2.1 and 7.1.8.

    I'm using the "legacy" (aka the working) XR plugins from the asset store (OVR) and package manager.

    Tried both Single Pass and Multi Pass stereo rendering with low overhead mode and V2 Signing.

    On the URP asset;
    -MSAA: 8x
    -Render Scale: 1
    -no depth or opaque texture

    The OVR Manager;
    use recommended MSAA Level: false

    Using the CenterEyeAnchor camera;
    Object Tagged MainCamera
    Renderer set to 0: ForwardRenderer
    Post Processing: false
    Anti-Aliasing: none
    Opaque Texture: Use Pipeline Settings
    Depth Texture: Use Pipeline Settings
    HDR: Use Pipeline Settings
    MSAA: Use Pipeline Settings


    I'm doing this in my gamemanager:

    Code (CSharp):
    1. /// <summary>
    2.     /// Setting overrides that doesn't work correctly or is not available in the unity editor GUI.
    3.     /// </summary>
    4.     private void Start()
    5.     {
    6.         QualitySettings.vSyncCount = 0;
    7.         Application.targetFrameRate = -1;
    8.         StartCoroutine("MSAAFix");
    9.         QualitySettings.antiAliasing = 4;
    10.         UnityEngine.XR.XRDevice.UpdateEyeTextureMSAASetting();
    11.         Debug.LogError(UnityEngine.XR.XRSettings.eyeTextureDesc.msaaSamples);
    12.     }
    13.  
    14.     /// <summary>
    15.     /// Fixes MSAA not being applied in VR with URP. Taken from; https://forum.unity.com/threads/quest-lwrp-urp-msaa-not-working.786026/
    16.     /// </summary>
    17.     /// <returns></returns>
    18.     IEnumerator MSAAFix()
    19.     {
    20.  
    21.         UnityEngine.XR.XRSettings.eyeTextureResolutionScale = 0.5f; // Any value, just to trigger the refresh
    22.         yield return new WaitForEndOfFrame(); // Needed to apply the changes
    23.         UnityEngine.XR.XRSettings.eyeTextureResolutionScale = 1f; // Use your target resolution here
    24.         Debug.LogError("after: " + UnityEngine.XR.XRSettings.eyeTextureDesc.msaaSamples);
    25.         yield return null;
    26.     }
    Both logs of UnityEngine.XR.XRSettings.eyeTextureDesc.msaaSamples shows 1.

    Is this bug acknowledged / worked on? Is there a temporary fix I can apply?

    P.S.
    I noticed that in URP 7.2 when disabling Post Processing on the camera, the Anti-Aliasing option is not hidden, where in 7.1.8 it hides it.
     
    Last edited: Feb 17, 2020
  49. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,390
    @TheVirtualMunk

    I have it working on Quest with the following:
    • URP 7.1.8
    • 2019.3.0.f3
    • Modified ForwardRenderer.cs as recomended in posts above to get rid of extra blit (which also makes MSAA and FFR work)
    • Switch of render scale for a single frame in game startup.
    • Setting OVRManager's use recommended AA to false via script at startup
    • MSAA set to 4x in Render Pipeline asset
    See if that specific combo helps
     
    Dragnipurake97, andybak and ROBYER1 like this.
  50. Brady

    Brady

    Joined:
    Sep 25, 2008
    Posts:
    2,390
    As an addendum, make a backup copy of your modified ForwardRenderer because everytime you restart Unity, you'll have to copy the changes over again as Unity overwrites any modified versions of the files in the packages folder.
     
unityunity