Search Unity

Resolved VR performance URP

Discussion in 'SRP Dev Blitz Day 2022 - Q&A' started by DevDunk, Sep 28, 2022.

  1. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    I see a lot of people complaining about VR performance in the URP, especially on android (which is almost all standalone VR hardware).

    Are there plans to fix this? It mostly comes from the lit shader according to CloudWalker.
    This is limiting a lot of devs to 2020, so they will miss the 2021 and 2022 features

    There is 1 issue fixed, 1 issue marked as duplicate falsly and 1 recent bug report which got through.

    Info page:
    https://forum.unity.com/threads/quest-2-performance-loss-2020-3-2021-3.1297833/#post-8446736

    Bug reports:
    https://issuetracker.unity3d.com/is...ot-2-and-trunk-shows-significant-gpu-increase

    https://issuetracker.unity3d.com/is...-slower-than-2021-dot-3-when-built-on-quest-2

    https://issuetracker.unity3d.com/issues/meta-quest-performance-loss-between-urp-versions-when-built
     
    peturdarri and jeromeWork like this.
  2. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    Thought it was just me! That performance regression when updating to 2021 is not fixed, no matter what those closed bug reports on the issue tracker suggest.
     
  3. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Anyone from the team?
     
  4. peturdarri

    peturdarri

    Joined:
    Mar 19, 2016
    Posts:
    23
    This doesn't address the main issue (performance regression in newer versions), but I would say it's a little surprising that people are using URP/Lit instead of URP/SimpleLit or something custom on Quest 2. The XR2 on Quest 2 is not low-end mobile hardware by any means, but it has to render a lot more pixels than most phones.

    It would be good to hear which shader Unity expects devs to use in mobile VR. Maybe they're not using URP/Lit in their own tests.
     
  5. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    In the duplicate issue which wasn't duplicate I used lit shaders. Not sure about the other repro projects
     
  6. Jonas-Mortensen

    Jonas-Mortensen

    Unity Technologies

    Joined:
    Jan 3, 2020
    Posts:
    110
    Yo!

    Performance regressions really should not happen without a very good reason. Truth of the matter is that our automated performance testing is not perfect. Yet ;) We will do what we can to rectify any unwarranted performance regressions.
    We are having ongoing discussions about our shader tiers and whether we should add more mobile friendly shaders. Stay tuned for updates on that.
    Personally I would not use the URP lit shader on something like the Quest and would instead do an unlit shadergraph (and do custom lighting in a custom function node). Doing custom lighting in shadergraph is not a flawless workflow but it can be done, and is performant if done right. Block Shaders are in active development and will make custom lighting models much nicer to do so stay tuned for that as well :)
     
    hippocoder and DevDunk like this.
  7. ManueleB

    ManueleB

    Unity Technologies

    Joined:
    Jul 6, 2020
    Posts:
    110
    some of the issues you mentioned are marked as fixed because the fix has landed in our branch, it doesn't necessarily mean that the changes made it to a package release yet. So should be available with the new update

    We are waiting for the XR team to come online so they comment on the specific issues, since I know few Quest2 performance fixes have landed recently for 21.3 but I am not familiar with the details
     
    DevDunk likes this.
  8. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    but surely the whole point of the URP was that it was going to be mobile friendly?...
    With specific reference to Quest2, I totally get needing to steer clear of screen space effects because of the tiled rendering but lit shaders... really? Personally I'm finding @jbooth 's BetterLitShaders to work great. My point is that porting a project with no changes from 2020 to 2021 should not lose me 3ms. With a frame budget of only 13.7ms for 72Hz (I usually like to aim for more) that's too much of a hit to swallow. I just went straight back to 2020.
     
  9. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Interesting to use custom lighting. Might look into it for some objects in our game!
     
  10. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    The VRChat crowd have been big on matcap materials for a good reason :)
     
  11. peturdarri

    peturdarri

    Joined:
    Mar 19, 2016
    Posts:
    23
    Maybe this is a miscommunication issue as well. I would view using URP/Lit for mobile VR the same as using Standard in built-in; not recommended unless you have a particularly simple scene.

    URP/Lit is certainly more performant than Standard, especially when it comes to real-time lights, but it's still a PBR shader and you're always going to pay a performance tax to do physically based rendering.

    So, URP/SimpleLit should be used on Quest, or if you want to squeeze as much performance and quality as you can, a custom shader tailor-made for your game is always going to be better than a general purpose one.
     
    jeromeWork likes this.
  12. jeromeWork

    jeromeWork

    Joined:
    Sep 1, 2015
    Posts:
    429
    Totally agree, SimpleLit is the way, but what was being suggested was Unlit. Not everyone has the knowhow to write their own (performant) shaders so we rely on the engine team, or third party sellers.
     
  13. jbooth

    jbooth

    Joined:
    Jan 6, 2014
    Posts:
    5,461
    One of the biggest performance issues for mobile VR is texture bandwidth, and the standard lit shader is terrible here. You can pack a full PBR material down to as little as 2 textures, but the URP lit shader uses 5. I'm sure that was done to make it use the same layout as BiRP, so that switching would be easier, but it does hurt performance. (Also there are quality downsides to doing this from compression, but even so a better layout like the one HDRP uses would have been nice)
     
    Last edited: Sep 29, 2022
    mgear, jeromeWork and DevDunk like this.
  14. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Any updates from the XR team?
     
  15. ThomasZeng

    ThomasZeng

    Unity Technologies

    Joined:
    Jun 24, 2019
    Posts:
    86
    Hi,
    I would like to comment on the issue with some more details.
    This issue is submitted by XR automation tests and the test repro case was using SimpleLit shader. Upon investigation, the performance regression is due to additional light variant which increased shader instruction count. That being said, if you see performance issue with the Lit shader, then that could be a separate issue. Performance regressions should not happen without a good reason. We will look into the Lit shader perf case.

    We understand our performance automation tests are not perfect and we have plans to improve the tests to cover more features and collect more metrics. This is a continuous effort and would help us we to catch and address performance regressions better.
     
    jeromeWork, ManueleB and DevDunk like this.
  16. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Sounds good!
    If people comment on performance issues I always recommend them to submit the project in a bug report to have a repro project
     
  17. FuturusDave

    FuturusDave

    Joined:
    Jan 21, 2022
    Posts:
    1
    The Oculus Integration update (47) seems to have fixed this for me. It came out yesterday.
     
    jeromeWork likes this.
  18. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Nice! Unity 2021.3.14 and newer also have good performance improvements
     
    jeromeWork likes this.