I have been developing a VR game for a long time now, and just as I was getting ready to release it to the Meta Quest store, I ran into the most frustrating issue I have ever encountered. The game is fine in play mode, running at a consistent 72 FPS, with decent tris and batches, no reason for performance issues with a build. But whenever I build my game and load it onto my Quest 2, it runs at what I’m guessing to be no more than 20 FPS, making the game unplayable. I have watched endless videos and read countless forums, and no matter what I do I cannot figure out how to get my build up to 72 FPS.
I’m using Unity 2022.3.37f1 and URP. Recently I’ve been working with baked lighting to see if that would improve anything, but all it does is make my game look worse with minor (if any) frame improvement.
This is my first time needing to post on a forum, so please let me know if there is anything you need me to provide to help. Any feedback would be greatly appreciated, I am completely out of ideas.
Here is a screenshot to show how it runs normally in play mode. With 97 batches, there is no reason for performance issues, which is why I am guessing there is a problem that I am not aware of, and hopefully, someone out there knows more about it than me.
I’m not super familiar with the hardware but from what I’ve read in the past it’s a lot like developing for mobile. The vert count and draw/pass calls don’t seem out of spec so I’d start looking elsewhere.
From what I gather the Quest 2 still uses a tile-based GPU which is notorious for handling certain things very poorly. Namely: alpha clipping and overdraw. If you need something to be transparent then you will want to use alpha blending in your shaders rather than alpha clipping. Better yet, try to avoid transparencies altogether since overdraw is a killer. Occlusion culling is very important for this reason too. Drawing to the same pixel should be avoided as much as possible.
Next up I’d say consider what shaders you are using. Are they mobile friendly? Do they use alpha clipping?
And then there’s post processing. Are you using any effects? If so… don’t. SSAO, FXAA, even HDR on the renderer itself should all be off.
Finally - lights. Are those baked lights or realtime lights? At most you probably don’t want more than one or two real-time light in view at any given time and even better if you have none.
If all that checks out then you’re going to have to dig deeper and try to profile (I have no idea how that works out with VR headsets but I’m sure there’s a way for Unity to remotely profile similar to mobile devices).
Thank you so much for your help! I’m using a bunch of assets and shaders from the asset store (namely Synty Studios), which I know can be a problem for performance when developing for mobile. Shaders have been my kryptonite since I started game development, but this may be the perfect reason to start learning more about them. Post-processing is something that I haven’t thought much about, and I’m going to dive a lot deeper into baked lighting and occlusion culling. I have tried both things, but the chances of me having done them wrong are high, and I will give them a second look.
I am not currently able to implement these changes into my game, but I will as soon as I can and get back to you right after. Thank you again!
When you say “is fine in play mode” - how do you play the game, through play mode, on your Quest2? How did you connect the Quest2 to the PC/Mac which runs Unity?
Yes, I use the Quest link feature with a cable running from my PC to my Quest 2, so when I click the play button I can see and interact with it like a normal game on my Quest.
I think at this point I know it’s a rendering issue, but more specifically something to do with lighting. Even on my tiny home page, I get around 40 FPS until I disable all of the lights, and then I get 72. This is especially weird because I use baked lighting. I think I just need to play around with it, but if anyone knows what I can do help would be greatly appreciated.
Having made a couple of VR specific assets I’m all to familiar with how hard it is to hit framerate on Mobile (VR).
a couple of points. Previewing on your PC using Link is not rendering anything on your device, your PC is using it’s GPU and only sending the visuals over, hitting framerate using Link is in no way related to the framerate you would get on the device natively.
The following is depending on your visual style offcourse, but, baking lights is almost a requirement. you can get away with 1 realtime directional light but you really should look into using baked lighting. This means you can do away with the expensive Standard materials and use the much faster Baked Lit shaders.
Try to get your lightbakes in one 4K lightmap or less.
Keep an eye out for texture sizes. Many times people use 1024 or higher resolution textures in places where only 512 or 256 would be enough.
When using URP, make sure it’s configered for VR. Have a look at page 31 and on in this guide for some sensible defaults. Also! make sure you’re using Multi-view (singlepass) rendering in XR settings.
Post Processing should be off, this is just to heavy for Quest2.
Batch size and triangle count is not the only metric to go by. It’s the combination of everything. as a general rule I try to keep below 400K triangles and try to make as many things as possible static.
Look into baking Occlusion Culling, this can make a huge difference when your level design is smart.
Thank you guys all for your help. I almost completely fixed the issue, and hopefully, I will release the game soon. The problem was a mixture of having too many complex models, not baking the lights correctly, and even though I wasn’t using post-processing there was a checkbox that had it enabled, and once I turned that off I saw a dramatic increase in frame rate. Huge thanks to TomGoethals, the Portals for VR documentation helped a ton.