Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Resolved Tips for HDRP + VR?

Discussion in 'High Definition Render Pipeline' started by Suggoo, Jul 27, 2021.

  1. Suggoo

    Suggoo

    Joined:
    Dec 3, 2018
    Posts:
    18
    I've set up a really small VR scene with only a couple models totaling ~8k tris (with LODs), 1 realtime light (which is set on "On Enable", not "Every Frame"), a small baked lightmap, and that's about it. I have a decent PC, I can run high-end VR games such as Half Life: Alyx really well.

    Why is my FPS stuck at around 30-40fps? It's playable, but not exactly comfortable in VR (which needs about 90fps). Seeing pretty big demo scenes work in VR + HDRP, I'm a bit confused what's going on that I'm not doing.
     
  2. koochy_rat

    koochy_rat

    Joined:
    Oct 26, 2011
    Posts:
    40
    Which HDRP demo scenes are you referring to?
     
  3. Suggoo

    Suggoo

    Joined:
    Dec 3, 2018
    Posts:
    18
    There was a HDRP VR Demo scene that I saw in this talk:

    Last I checked I'm pretty sure this has been released, though I've not tried out the project in Unity myself.

    I also came across this:

    Which isn't official by any means, and it does look a little thrown together - but it does demonstrate that HDRP & VR works pretty well!

    So I'm confused as to why my own tiny scene only pushes 25-30fps in-editor. In builds it's a whole lot better though, I've noticed after running a few tests today.
     
  4. koochy_rat

    koochy_rat

    Joined:
    Oct 26, 2011
    Posts:
    40
    In the first video, at 26:33 you can see the demo room frame rate is 30 fps. The second video didn't mention frame rate, but it does look very low. Both scenes don't look very fancy and can be done in URP or even built-in for better performance.

    30fps is about the same result I'm getting too for VR. The reason an empty scene runs so slow is because a lot of features are turned on by default. You can disable them in HDRP global settings, it will run better but will probably end up looking worse than URP.

    HDRP is meant for best visuals and it runs great in non-VR. However for VR, you need a performance level comparable to running in 4K at 120 fps. It's just not possible. Realistically you could target 45 fps with reprojection instead or render at a lower res and use DLSS to upscale. Otherwise just use URP and bake/fake all the lighting.
     
  5. Suggoo

    Suggoo

    Joined:
    Dec 3, 2018
    Posts:
    18
    Thanks for your advice! I've screwed around with the settings a bit more
    (lowering reflection quality, being extra careful with realtime lights/shadow casting, disabling things I'm not using, being smart with volumetric fog usage) and I've ended up with the HDRP visuals + 90fps in a build. I realize that HDRP + VR is probably one of the hardest things to do but I really want to build high end visuals for a potential VR game so I'm pushing through.
     
    Last edited: Jul 29, 2021
  6. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I suggest you get some frame profiler installed (I use Nvidia Nsight) to see where it struggles. Also make sure you run it using development build to get proper naming on things that show on the frame profiler. With that you can see bunch of small things you may have not thought about before, for example you can see that you should disable distortion and SSS etc from frame settings if you don't use them as they do come with a cost (even when your materials don't use them).

    HDRP VR is a hard combination and it will inevitably raise your end product min spec by big factor. I've played with this in past and even with all the fancy things stripped out, URP runs same scene at literally half the frametime in VR.

    I've played a bit also with AMD FSR, Nvidia DLSS and new HDRP TAAU in VR. Without image quality taken into account (I've mainly tested the pure performance with different options), TAAU seems like a nice option since you can do like 80% resolution and without paying huge extra cost on AA. HDRP VR and DLSS is kinda difficult combo because for DLSS to help, you'd have to have a ton of HDRP features enabled to make it worth the extra overhead. DLSS on it's own cost like 4+ ms on my VR testing with something close to native Quest 2 resolution. If you've already slimmed down HDRP to bare bones, DLSS makes no sense as it's just always going to end up being more expensive to render.

    I do stress that you can make HDRP more feasible in VR if you strip everything out but there's not all that much left of HDRP at that point and you can then question yourself if you really should go with twice more performant solution instead (URP).
     
    Suggoo likes this.
  7. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    HDRP + VR is for 3090 at a minimum. I did not notice any optimisation notes so likely HDRP is doing a lot of work twice.

    Recommend URP for VR right now no matter what quality level. VR is too performance dependent not to.
     
    cecarlsen, mohantobipul and Suggoo like this.
  8. rz_0lento

    rz_0lento

    Joined:
    Oct 8, 2013
    Posts:
    2,361
    I got simple scene running just around 120Hz at native Quest 2 resolution on my 2070 Super. But it's still crazy expensive in comparison to URP.
     
    Suggoo likes this.
  9. hippocoder

    hippocoder

    Digital Ape

    Joined:
    Apr 11, 2010
    Posts:
    29,723
    Wow! That's pretty darn usable isn't it? but again, there's probably a lot of optimisations HDRP team can do but have no real mandate or time to do so. This is only based on reading the patch notes, so I could be wrong but I do think there is probably a lot of redundant work done each eye.

    URP does have some places where we we'd like to be able to say OK this is far off - we don't need to transform it per eye, or maybe save some other calculation but URP by default doesn't do any real prep per eye so what it does do inefficiently might not make much difference while with HDRP it would as it does so much up front.

    DXR reflections in VR with DLSS is definitely a thing that can be done, for the biggest machines.
     
    Suggoo likes this.
  10. Suggoo

    Suggoo

    Joined:
    Dec 3, 2018
    Posts:
    18
    Well I'm glad this at least sparked a little VR + HDRP discussion! Doing my own research online, any mention of HDRP + VR development seems to be really rare. Proobably for good reason haha

    I'll try out profiling, but it's just out of sheer curiosity at this point. The initial reason why I'm doing HDRP + VR in the first place is not necessarily for an end product or game right away, moreso just for testing and recording videos of my shaders. I know my way around HDRP pretty well at this point (on it since about 2018) and I wanted to really challenge myself with optimization so HDRP + VR seemed fun!
    (I've also been playing HL:Alyx for the first time and its volumetric fog had me jealous, I'll be honest.)

    By frame settings you mean the default HDRP Asset and Project Settings, right? I've turned off most things I don't use. I also saw somewhere that it was recommended to take Area Lights out of the engine completely, but me attempting that I broke the whole pipeline's rendering (gray viewport) and managed to restore it by the skin of my teeth. ^^'

    If I ever end up going for a full VR game though, I think it's best to start with URP and add onto it instead of starting with HDRP and ripping stuff out. Unless the HDRP team comes along and makes improvements to VR optimization, that is!
    I do so hope they will at some point though. I know realistic art isn't a feasible goal for many developers, especially for VR, but there's a lot of untapped potential here.
     
    mohantobipul and PutridEx like this.
  11. JasonB

    JasonB

    Joined:
    Dec 29, 2010
    Posts:
    102
    Realistic VR is feasible. Alyx runs really good on my 1660 Ti and it looks amazing.

    I tried HDRP for VR and it's just a bad idea. The frame rates aren't great and most of what HDRP allows for, you don't even really want in a VR game (ideally you want ZERO post effects except maybe for AO). In all my experimenting with the URP in VR, my philosophy for beautiful VR games (realistic ones anyways, like Alyx) is all in the texturing, modeling, and lighting. I have moderate sized albedo maps coupled with high resolution normal maps, NO sharp edges on your models (any 90 degree edge should be beveled, real life doesn't have razor sharp corners and it breaks immersion), and handmade dirt maps (for things like smudges, fingerprints, imperfections, anything to modulate and break up the specularity, it's necessary for realism). None of that requires HDRP.

    Where I depart from Alyx is I want to aim for zero baked lighting, mostly because I have a game where it doesn't make sense to bake lights. So I'm carefully tweaking real time lights, their shadow resolutions, light layers to only shadow necessary things, and a slight AO pass with a large sample radius to darken occluded areas. I'm also trying to avoid any large homogenous surfaces that would more clearly show low shadow resolutions and such.

    However, I'd really like to have FSR in URP. Would give me a lot more wiggle room.
     
    Suggoo, rz_0lento and PutridEx like this.
  12. Suggoo

    Suggoo

    Joined:
    Dec 3, 2018
    Posts:
    18
    You raise very good points and I wholly agree. I had already started migrating my project to URP just as I happened to read your reply. Just for my own development ease, more than anything.
    I still had the mentality of old URP still stuck in my head, where for example the base material shader was as basic as can get. But looking again at how far URP has come, and the planned roadmap features, I'm moving this project over.
     
  13. mohantobipul

    mohantobipul

    Joined:
    Aug 18, 2021
    Posts:
    13
  14. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    HDRP works fine with OpenXR (or with SteamVR, too).

    Only issue is that some effects won't render properly in VR, but that is not dependent on the used headset, it's just that "Single Pass Instanced" is not properly supported by:

    - Water (refraction is off)
    - Lens flare (is rendered twice)
    - new "High Quality Line Rendering"
    - SSAO seems also a bit off

    I reported the first three of above as bugs which got accepted by QA, so fingers crossed that we'll have full VR compatibility soon.
     
    mohantobipul likes this.
  15. DriesVrBase

    DriesVrBase

    Joined:
    Mar 24, 2020
    Posts:
    64
    Got a link to the bug reports so we can follow? :)
     
  16. Qleenie

    Qleenie

    Joined:
    Jan 27, 2019
    Posts:
    851
    DriesVrBase likes this.