Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Best VR Anti-Aliasing solution(s)

Discussion in 'VR' started by Vanz, Feb 23, 2022.

  1. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Hi All,

    Been trying around FSAA, MSAA x2, x4 …etc and not happy with any of the results, tried the below free asset and it did not improve my AA at all in VR,

    https://assetstore.unity.com/packag...ects/fxaa-fast-approximate-anti-aliasing-3590

    The MSAA 4X looks the best and does a pretty good job on jaggies but my frame rate went down by about a 1/3.

    So for now I am running with no AA but the jaggies are making my eyes bleed.

    What are you all running and are there any good assets that work well in VR (decent AA and FPS)?

    I’m working on an indoor environment game on the Quest 2, on Unity V. 2021.1.16f1

    Thanks,

    Vanz

    ps. google this many times but most solutions are quite old, also wondering what is newer that works well
     
  2. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    MSAA 4X. Nothing else and that's a fact. This is something you have to work with on that hardware, and I suspect you're measuring the cost of it incorrectly, or blaming it when really it's a tiny cost that is the straw that breaks the camels back.

    There also isn't anything faster than it on Quest.

    What is that in millisecs?
     
    GabrielMachadoGomes and DevDunk like this.
  3. glenneroo

    glenneroo

    Joined:
    Oct 27, 2016
    Posts:
    228
    Which rendering pipeline? Show us your settings.

    If you are using Universal Render Pipeline, you could try to decrease the Render Scale value under the URP Settings > Quality > Render Scale. It will have an impact on performance but perhaps in your situation it will not be detrimental.
     
  4. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Thanks a lot, really appreciate the feedback, see pics below with profiler.

    Pipeline = URP

    Pic1 and 2 are with running game through Laptop with link cable viewed through headset.

    Pic3 and 4 are (after many trials) getting unity to run the game through my headset without the editor (remote profiling).
    Link Cable connected, game running on Quest 2, Game not running on Unity, game sync'd with Profiler.

    So to clarify, when I just run the APK in my headset with no AA I get 70'ish FPS, when I enable MSAA 4X I get 35'ish FPS.

    Thanks again for any feedback and recommendations...

    Vanz













    Settings,
     
  5. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    That's what I expected. I in this case, MSAA is only the straw that breaks the camel's back. Let me explain: it doesn't cost half your framerate.

    When you have vsync and don't meet the framerate target, it will wait for the next frame, effectively halving your framerate. This isn't because of MSAA, it's because you've broken your budget long before then.

    The actual cost of MSAA is very little, but just enough to push you over the edge and let vsync halve your framerate. To fix this, optimise it elsewhere.

    TLDR: it is probably your shaders/other choices that leave you right near the edge before AA. You just can't develop like that on VR. You can also look into FFR and other techniques to buy back performance or use cheaper shaders / no HDR etc.

    Put your profiler in hierarchy view and sort the columns by millisecs for another view.
     
  6. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Thanks hippocoder, it's tough, I try hard to make all my scripts efficient and have went through so many optimization tutorials but designing in VR and as a hobby I just don't have the knowledge or experience yet... but I'm trying and I'll keep struggling... thanks for taking the time to help us newbs out...

    I don't necessarily think its the proverbially, straw that breaks the camels back though, because if I remove about 1/4 of my geometry (just disable it) the problem remains, I think I have a more deep rooted problem. Your comments sparked many thoughts and ideas, one being shader choices, when I buy an asset from the store and everything comes out pink, I don't do a good job of finding an efficient shader or even know which are the more efficient shaders. I tend to grab the first one that works that gives me a decent image, I'm going to dig deeper into this.

    Also, light baking, I thought if I did this, it would help, but if I turn off ALL of my lights the problem remains.

    What makes this problem extra frustrating, is that I only see the issue when I export to apk and run my game in my head set, if I run via laptop and link cable the FPS's are similar with and without MSAA 4X. Which I guess makes sense as I have a decent GPU on my laptop.

    Thanks again,

    V
    ps. FFR is another great suggestion, thanks...
     
  7. mabulous

    mabulous

    Joined:
    Jan 4, 2013
    Posts:
    198
    It's not all that little actually, especially on tiled rendering hardware. Whereas on that hardware the MSAA resolve happens before reading out the data and thus GMEM bandwidth isn't increased, the larger memory footprint of the buffer yields a higher number of tiles and since there is a per-tile overhead, you can definitely get much better performance without MSAA.

    For me what worked best for high-performance mobile VR is to not use MSAA but instead rely on shader based tricks (not post processing, but directly during ofrward rendering) and texture filtering to do anti-aliasing.
     
    glenneroo likes this.
  8. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    Thanks mabulous, could you elaborate a little?

    What were you seeing is terms of FPS differences with MSAA and no AA?

    If I disable a 1/3 of my scene the FPS difference is still quite large, so I don't think its the "straw breaking the cammel's back" situation.

    Vanz
     
  9. mabulous

    mabulous

    Joined:
    Jan 4, 2013
    Posts:
    198
  10. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    I did not, I am working with Oculus OVR right now and do some side by side comparisons. Some early things I'm noticing is that real time lighting seems to have a big hit on MSAA 4XX but not so much on NO AA... one important feature in my game is that the player can walk around with a torch so I can bake most lights but not all...

    Thanks for the above info mabulous

    Vanz
     
  11. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    I also wanted to use real-time lighting in Quest 2, but it is not always possible to maintain the required FPS (because AA)


    that's why I removed all the real-time lights and started using decal shadows- but it's a completely different game :)


    use FFR: Using Fixed Foveated Rendering | Oculus Developers it helps a bit
     
    Last edited: Mar 15, 2022
  12. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    interesting... thanks fuzzy3d, what kind of an improvement in ms or FPS did you see with FFR?
     
    Last edited: Mar 16, 2022
  13. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    so is that a common recommendation in VR, do no use real time lighting with MSAA 4X? I would think it would be on a case by case basis but I mean in general is that a rule of thumb? I get there may be exceptions... but I have not heard that before... thanks...
     
  14. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Er... do these realtime lights have shadows enabled, and are they point lights?
     
  15. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    FFR technology gives me about 5-15fps with my setup, worth trying.

    void Start()
    {
    OVRPlugin.fixedFoveatedRenderingLevel = OVRPlugin.FixedFoveatedRenderingLevel.HighTop;
    }


    MSAA 4x is lowest painless AA for me. Rendering scale 1.

    I tried a point light, spot light without and with shadows tuned to the lowest level, but I couldn't keep 72 FPS absolutely stably. So now I have no lights at all, lightprobes and baked only. + decal shadows.

    Maybe Quest 3 gets the lights back?

    EDIT 16.4.2022: After returning to the Oculus Quest project, I can't restart FFR (so I can see the pattern). In the meantime, I switched to the new version of Unity and Quest was also updated several times ...

    EDIT 26.1.2023: new project with 2021 and everything works fine
     
    Last edited: Jan 26, 2023
  16. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    point light, no shadows enabled, they are torches in the game...
     
  17. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    wow, that's a lot, thanks for sharing...
     
  18. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    22
    Hi, could you explain more about the shader trick? It sounds really helpful and interesting,
     
  19. Vanz

    Vanz

    Joined:
    Nov 19, 2013
    Posts:
    374
    +1
     
  20. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
  21. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    Hey guys,

    I also struggle for years on this for mobile VR on Quest 2. I almost avoid metal elements since flickering is so bad (bad AA).
    I recently moved to a new project on PC VR, using Quest 2 with link. I was expecting then super beautiful images as the PC hardware is doing the work, but aliaising is still bad. Is that normal ?
    I did not activate post processing yet and there is some kind of AA in there if I am right; should it be on for PC VR ? Does it cost a lot in performance ?
    I just can't find how developpers get AAA quality VR games, would Unity itself be the limitation ?
     
  22. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    The basic way to improve the quality of aa in quest 2 (for me (right now)) is to use urp and "render scale" >1. The display quality can then be close to hp reverb g2.
     
    Last edited: Jan 6, 2023
  23. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    Thank you for this answer.
    But I read a few sources combined with my own experience on Unity 2020/2021 that URP for VR is not working well, better stay with the standard pipeline. Is it something you experienced as well?

    Render scale I believe is killing performance, so beter not make it very high. What value do you use above 1? 2 or something ? or 1.1 or similar ?

    Thanks
     
  24. fuzzy3d

    fuzzy3d

    Joined:
    Jun 17, 2009
    Posts:
    228
    All I do are tests only. And i am testing a specific type of scene (de-facto industrial design (high poly count, graphic quality)) and differs from typical scenes for games.

    Yes, render scale significantly reduces performance, but solves aa and display quality. It is necessary to find a compromise and the performance that I will lose in this way I have to find/save elsewhere.

    Buil-in pipeline is deprecated for me.

    This is experiment urp 2022.2 beta, meta quest 2, render scale 1.92. Untethered, android. Exterior is stable 72fps, problem is interior. Interior has cca 800 000tri, this is limit poly count for hw (according to meta doc.).

     
    Last edited: Jan 10, 2023
    glenneroo likes this.
  25. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    stupid question, but I can't figure out how to change the render scale in my project using the build in pipeline... Can someone help on this ?
     
  26. Wanyudo

    Wanyudo

    Joined:
    Nov 9, 2021
    Posts:
    2
  27. Liminal-Ridges

    Liminal-Ridges

    Joined:
    Oct 21, 2015
    Posts:
    255
    any updates on better antialiasing solutions other than x4?
     
  28. bdeschryver

    bdeschryver

    Joined:
    Jun 13, 2013
    Posts:
    93
    I just did some extra testing (Unity 2022 LTS with URP) on different settings of MSAA and also TAA as suggested.
    MSAA 4x is definitely the best default setting with lowest performance cost. (checked 72fps on quest 3 on 3 different spots of my scene).

    TAA is quite interesting. Used in "high" quality setting, it has a too big impact on performance and smoothes the scene too much (58fps).
    With TAA set to low quality and sharpening to 0.5, it gives good results to me, with almost no change in fps.

    Render scale definitely helps also but cost is too big to me (render scale 1.4 cuts to 36fps in my case).

    Still interested to see what your settings are ! (Quest 3 Android build)