New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Does turning ARCameraBackground on/off change the camera FOV? #727
Comments
|
The ARCameraBackground sets the projection matrix, which can change the FOV. If you want to turn off the ARCameraBackground, you can still set the projection matrix yourself by subscribing to the ARCameraManager's frameReceived event. |
|
Thanks @tdmowrer for pointing me in the right direction. The projection matrix indeed seems to be the issue. I fixed the projection matrix shift with this code using the cached projection matrix from before activating ARCameraBackground. However this causes an issue where the AR layers don't look as good as they did before. They are slightly enlarged and not as well 'glued' to the markers as they are when the projection matrix is not changed. I am going to try the opposite, applying the ARCameraBacground matrix to the rest of the scene when the ARCameraBackground is disabled. |
|
You need to use the projection matrix provided by the if (eventArgs.projectionMatrix.HasValue)
{
Camera.main.projectionMatrix = eventArgs.projectionMatrix.Value;
}(assuming |
Thanks @tdmowrer I figured that out when I tried to fix the AR tracking issues I was experiencing. Thank you again for pointing me in the right direction! Unfortunately this solution doesn't work for my use case either, as eventArgs.projectionMatrix.HasValue returns false for about 12-15 frames every time the ARCameraBackground is disabled. It seems like the camera 'resets' the projection matrix during that time. The result is a glitch where my UI is larger for those 12-15 frames and then shrinks, every time the ARCameraBackground is disabled. The workaround I found at the moment is to use a special scene when the app is launched, to cache the ARCameraManager projection matrix as soon as it becomes available. Then I load the home of the app. However in this case I apply the projection matrix to the AR Camera constantly in LateUpdate, apart from when the ARCameraBackground is enabled. Like so: where This seems to work. Can you think of a reason why this is a bad idea or a better way of doing this? Thanks a lot! |
The ARCameraBackground has no effect on the camera frame event, so this should not be the case. Are you doing anything else (i.e., affecting enabled AR features) at the same time? |
@tdmowrer See this screecapture video (better to download it as it will be clearer). You can see that everytime the bottom right toggle is deactivated (which disables the ARCameraBackground) the UI 'jumps' This also happens when the scene first loads, as I disable the ARCameraBackground in Awake. This is the script I have on the AR Camera to apply the and this is how I am disabling the ARCameraBackground with the toggle in my UI manager script I am not doing much else, apart from SetActive(true/false) on a few UI elements in the world space canvases, no more than two at a time. |
|
Hi @tdmowrer I have modified my script to print the camera projection matrix on Update, like this: and I found that the projection matrix resets for one frame when I disable the ARCameraBackground. This is on the Samsung S8: I also noticed that when the scene is first loaded, it takes 8 frames on the pixel 4 and 5 frames on the samsung s8 for The workaround I described before (caching eventArgs.projectionMatrix.Value on a |
|
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. |



Unity 2020.2.1f1
ARFoundation 4.0.9
Testing on Android (Pixel 4) and iOS (iPhone XS).
I am experiencing an issue where my canvases set in world space change size according to whether ARCameraBackground is enabled or disable on the AR camera. Why is that? It looks like the camera turns into a Physical camera but the FOV on the actual camera component doesn't change at all, yet the UI shrinks.
I am trying to have a floating UI with a 3D cube in the background to interact with as if it was an AR layer, but I don't want to see the camera feed until I enable it manually. That's why I am enabling/disabling the ARCameraBackground.
Any idea about how enabling / disabling ARCameraBackground affects the camera FOV or other parameters?
The text was updated successfully, but these errors were encountered: