Quest 2 update broke my Unity game...

Started by
2 comments, last by PenProd 2 months, 1 week ago

(I've asked this very same question on both the Unity forums and the Unity3D Reddit, but both seem ghost towns…)


TL;DR

After a while (seconds to minutes), objects in my game glitch in and out of existence. It gets progressively worse until the screen is nothing more than a jumbled mess. After a lot of testing, I found out some “mixed” point lights are the probable cause. If I remove those lights, the glitching is gone. I'm using the URP Ultra Forward renderer.


In More Detail

Not sure which Quest 2 update exactly broke the game since I only noticed it a few days ago. I know it's caused by an update since I have the game running here on 15 different Quest 2's and none were experiencing any problems just a few months ago, and now all Q2's show this problem...

Anyway, my game was built using 2021.3.21f1.

The game still runs without any problems on the Quest 1 and the Quest 3. But on the Quest 2, it glitches big time. Objects blink in and out of existence continuously.

The game is made up of three scenes. It doesn't glitch on scenes 1 & 2, and only starts glitching when in scene 3 - and not immediately. You can walk around in that scene for a bit but after a while (sometimes after 10 seconds, sometimes after a few minutes) it starts glitching. If I call up the Quest menu (by clicking the Oculus button on the right controller), the menu displays fine while the game is glitching in the background.

What actually happens, is that objects briefly (a few frames) glitch in and out of existence, so you actually see what's behind the objects (the white dots you see in the video below are the stars outside). The glitching does gets worse over time. You'll see different things happening, like a tiled screen with each screen displaying a render of a frame, but from a completely different angle than where the camera is. And eventually, the screen is just what looks like random pixels.


Debugging

At first I thought it might be corrupt occlusion data, but rebaking the occlusion data or even completely omitting it, did not solve the problem. I also tried 2021.3.35f1 but that did not make a difference either.

I've ran the OVR metrics hub and memory does get low, but IMO not fatally low. In OVR, it says there's still "777" available memory. I assume that's 777MB (since when nothing is running, it says there is 2500 free, and I'm guessing that's 2.5GB).

I also updated to 2022.3 LTS, rebaked occlusion data and light maps. And the problem is still there... I think it might be a problem related to Vulkan since if I remove Vulkan from the list of Graphic APIs (and only leave OpenGLES3), it doesn´t glitch. Well, it doesn´t glitch like this but I have all kinds of other lighting problems (so switching to OpenGLES3 isn't a solution).


Possible Cause

In order to find out what is causing the glitch, I removed all game objects one by one, rebuilding the game after every removal. At the end, I only had the floor and a 8 “mixed” point lights left, and it was still glitching. So at least I now know it isn't memory related. Since I didn't suspect the floor (a simple plane) was the problem, I removed the lights and added a few game objects back in. No glitching. In fact, I could add all game objects back in and the glitching didn't return. But as soon as I added (a few of) the lights, the glitching was back. I tried changing the settings in the URP renderer, but nothing seemed to make a difference.


My Question

Please help me debug this problem…

UPDATE 1

I tested a bit longer and it does glitch with those lights removed, it just took a bit longer before the glitching began. So apparently, those lights are not the cause. But it might still be related to the lights, because other lights were present.

UPDATE 2

I left it glitching for a while and noticed that eventually it rendered two completely different images for each eye, each from completely different angles as if there were two camera's instead of one.

Advertisement

As guesses, I'd look into the details of the many “performance upgrades”. Quite possible your game was relying on a feature that is no longer supported.

I'd also scour your game for resource leaks, any object with high count numbers, look for objects that might not have registered correctly with various hardware systems, and that when they're removed old references are also completely removed. You could have stale objects that are accumulating and consuming IDs or resource slots or something similar in a way that new ones can't be added properly.

Could be dropped frames, could be something in the world causing occlusion, could be something causing camera position to jump unexpectedly, could be just about anything.

And from your second edit:

PenProd said:
eventually it rendered two completely different images for each eye, each from completely different angles as if there were two camera's instead of one.

Yes, that's exactly how it works. You're using two and possibly three cameras, two for the stereoscopic display and maybe a third for your monitor. With that drift, look for whatever is moving or adjusting cameras, and whatever code you have that keeps the two eyes in sync together. Or also possible, the code that you don't have but should that keeps them properly configured. Many systems will automatically pull in IPD, as one setting of out many, only to have game camera manipulations mess those up.

Thank you for your answer!

I got rid of the glitching, but it's more a temporary fix than a permanent one. I'll explain why.

In one of my last tests, I only had the 8 lights and a floor in my scene. I had all other objects deleted and still it glitched. Then I realized I hadn't deleted all objects. The spheres around my lights were still there. I had placed the point lights inside emissive spheres (you can see them on the stairs in my video). For some reason, I had “Cast Shadows” set to “On”. But even though the lights were inside the spheres, the spheres did not cast a shadow. I can remember reading somewhere that when a light source only encounters backfaces of an object, it actually ignores the object which would explain why they didn't cast a shadow.

So I set “Cast Shadows” to “Off” for all the spheres and boom - no more flickering! But this was with the floor as only other object. So I restored all object from the scene, rebaked lighting and was happy to see there was still no flickering. I did notice however I was getting way worse frame rates than before until I realized I didn't have any occlusion data since I had deleted that in earlier tests.

So I rebaked the occlusion data and much to my dismay, the flickering returned immediately. Clearing the occlusion data made the flickering go away again. So apparently, it's a combination of two things that caused the flickering. The spheres around the light sources, and the occlusion data.

Of course, omitting the occlusion data isn't really an option. So I'm still looking for a permanent solution. But at least I now know what's causing it.

This topic is closed to new replies.

Advertisement