google-ar / arcore-unity-sdk

ARCore SDK for Unity
https://developers.google.com/ar
Other
1.4k stars 400 forks source link

Camera texture stops updating although tracking continues #169

Closed scott-a-ashton closed 6 years ago

scott-a-ashton commented 6 years ago

Hi I have an issue using Unity 2017.3.1p3 where the camera texture can sometimes stop updating - ie it freezes - and yet tracking still continues, so then the screen is no longer being cleared(as the Unity camera is Depth only clear) , which is obviously results in a bit of a mess.

My app has to run on iOS and Android. I was using Vuforia's ground plane - only to my recent dismay finding out that ARcore was not being used yet, despite them claiming that it would be when ARcore reached 1.0. It's now 1.1! And so I've had to create an ARcore implementation. It's a relatively simple scenario that I could adapt the HelloAR example.

This means that ARCore has to coexist with Vuforia in the same Unity project. Could this make a difference? Vuforia has this insane behaviour that their VuforiaBehaviour component is attached to your camera automatically - and this is even though ARCore is enabled, and Vuforia is disabled. Grrrr. Ugly code gymnastics are required to turn it off, but in that single frame where it was enabled, who knows if that would have caused issues for ARCore? I don't know if this is the cause - I'm just mentioning it as a possibility. Vuforia also has delayed initialisation enabled so in theory it shouldn't interfere (more than being an annoyance).

What I can say is that it happens more frequently on the "older" phones like Google Pixel and Samsung S8. On Pixel 2 it's extremely rare.

Given the black box nature of Unity all I can do is to trial and error change things around - but I've never been able to get rid of the issue.

Has anyone else had this experience?

Thanks Scott

pablisho commented 6 years ago

Hi, I cannot speak for configurations with other frameworks. Could you repro with an ARCore only project? Or share any logs of the error?

scott-a-ashton commented 6 years ago

Unfortunately there are no logs to indicate an error. The camera texture has clearly stopped updating (ie clearing the screen) to Unity at least, but tracking continues as normal.

You can see from the screenshot that the 3d content continues to draw (but not be cleared)

Sorry, I know that's not very helpful.

screenshot_20180409-121006

rory-lutter commented 6 years ago

Ever Find a solution for this?

rory-lutter commented 6 years ago

So, I have discovered that this, for me at least, has been tracked down to a single piece of geometry.

I still do not understand what ARCore disagrees with for this piece of geometry, but I have determined that this mesh, alone, causes the camera clear to stop behaving properly.

My guess would be some sort of messed up bounding box or something, causing the camera to believe it is entirely occluded, and ought therefore be culled.

rory-lutter commented 6 years ago

Turned out to have negative scale.

cvasquez-github commented 6 years ago

Hey guys, I'm not sure if it is related, but I have seen a weird behavior like that when using OpenGL 2.0. If you explicitly set the Project to use OpenGL 3.0 graphics api (or Automatic Graphics API), it works fine for me. BTW i'm using Unity 2017.3.1p4.

pablisho commented 6 years ago

Hi @scott-a-ashton do you still experience this issue? Were you able to repro in a simple ARCore project (just adding your model to HelloAR for example)? Does it happen without ARCore too?

scott-a-ashton commented 6 years ago

Hey @pablisho - I'm not able to follow this up at the moment as I'm working for a different client. I believe there will be a chance to review. At that point I will push for the project to upgrade to Unity 2018.1.0f2 so hoping that all the issues will disappear. So for the moment, I have to sit tight. Sorry for that. Scott

pablisho commented 6 years ago

@scott-a-ashton no problem, I'll close this because I don't have enough evidence to think this is an ARCore issue. Feel free to reopen if you still experience the issue and you cannot repro without ARCore.