Closed silverua closed 3 years ago
You have to manually set a Camera resolution that supports the Auto Focus mode. I don't have any sample code offhand but there is documentation on it.
@rogueyoshi Thanks for the reply. I will give it a try. Pixel 3XL does have an odd screen resolution and maybe that's the reason. Although, have not found any documentation pages that mention which resolutions support Auto Focus Mode and which ones don't. I will keep searching, but if you can share a link, I'd greatly appreciate it.
Same dang issue, @silverua find any fix for this?
Not that I know of, unfortunately. We were forced to go with 2.something versions of the packages that I mentioned above because of this.
According to Google's list of supported devices, the Pixel 3 XL uses fixed focus when in 60 fps mode:
When 60 fps camera capture mode is active, the camera uses fixed focus
60 fps is the default on this device, so auto focus is also disabled by default. There is no way to directly detect this case via the ARCore SDK; you must be aware of this via the documentation.
The reason this works in earlier versions of the ARCore XR Plugin is because older versions of the ARCore API did not support 60 fps.
You can enumerate and set a configuration using the XRCameraSubsystem.GetConfigurations API. The CameraImage
sample in this repo does this (code snippet here).
@tdmowrer Thanks Tim, that is very helpful info, and I was able to set an 30 hz config and solve the focusing issue (at least technically). Do you know if there is a way to detect the focus mode of the actual camera? At this point I'm trying to solve the UX problem of detecting an issue like this and perhaps prompting the user to set a configuration..etc, or maybe just going down the route of device detection for this case. If you happen to have any UX guidance for this type of issue I am all ears too :D.
There is no API in ARCore to detect this, no. It might be possible to use the standard Android camera API: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest#CONTROL_AF_MODE
But I'm not sure you can access it while ARCore is running.
According to Google's list of supported devices, the Pixel 3 XL uses fixed focus when in 60 fps mode:
When 60 fps camera capture mode is active, the camera uses fixed focus
60 fps is the default on this device, so auto focus is also disabled by default. There is no way to directly detect this case via the ARCore SDK; you must be aware of this via the documentation.
The reason this works in earlier versions of the ARCore XR Plugin is because older versions of the ARCore API did not support 60 fps.
You can enumerate and set a configuration using the XRCameraSubsystem.GetConfigurations API. The
CameraImage
sample in this repo does this (code snippet here).
Could you please update the code snippet? I am having the same problem and looking for a way to deal with it.
@tdmowrer Thanks Tim, that is very helpful info, and I was able to set an 30 hz config and solve the focusing issue (at least technically). Do you know if there is a way to detect the focus mode of the actual camera? At this point I'm trying to solve the UX problem of detecting an issue like this and perhaps prompting the user to set a configuration..etc, or maybe just going down the route of device detection for this case. If you happen to have any UX guidance for this type of issue I am all ears too :D.
Could you please elaborate on how you forced the framerate to 30? I am having the same issue, but I could not find the way to manually set the framerate to 30.
The code snippet linked above referred to the master
branch, which has been renamed to latest-preview
. The updated link is therefore https://github.com/Unity-Technologies/arfoundation-samples/blob/latest-preview/Assets/Scripts/CameraConfigController.cs#L81-L107
The code snippet linked above referred to the
master
branch, which has been renamed tolatest-preview
. The updated link is therefore https://github.com/Unity-Technologies/arfoundation-samples/blob/latest-preview/Assets/Scripts/CameraConfigController.cs#L81-L107
Thank you for the info. By the way, is there a way to manually force the fps to be 30fps on Pixel3 XL? application.targetFrameRate did not work, so I wonder how I can work around this problem.
Frame rate is a property of the camera configuration. The samples shows how to enumerate and pick one.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
We are making a project with image tracking and we were using these versions of the packages: "com.unity.xr.arcore": "3.0.1", "com.unity.xr.arfoundation": "3.0.1", "com.unity.xr.arkit": "3.0.1", The FocusMode on the ARCameraManager is set to Auto. Experienced this issue: On the Pixel 3XL phone the camera is not focusing at all and behaves as Fixed focus instead. The default focus is quite far from the camera, so the objects close to the camera are always blurry. Pointing the camera at near/far objects does not change anything, the focus is still fixed. At the same time, everything works perfectly on our other test phone, Xiaomi MI9. Tried setting the focus mode to Auto manually in Update() as suggested on Unity Forums: https://forum.unity.com/threads/disabling-auto-focus.580510/ Did not work. Tried the 3.1.0 versions of the packages with the same results: works as intended on Xiaomi MI9, no focus at all on Pixel 3XL.
Started rolling back the packages trying to find the combination that would work on both test phones. Along the way ran into 2 other known issues: 1) Camera not turning on after reloading the AR scenes. 2) Tracking events removed or limited not being sent correctly when the tracked image is lost resulting in tracked object prefab staying on forever and never being removed.
Discovered that these packages are working both on Xiaomi MI9, and Pixel 3XL (no issues mentioned above, no focus issues on Pixel 3XL) "com.unity.xr.arcore": "2.2.0-preview.2", "com.unity.xr.arfoundation": "2.1.4", "com.unity.xr.arkit": "2.1.2",
Has anyone experienced this before? Any advice on getting the focus working with the latest versions of the packages on Pixel 3XL?