Log in or register to post comments

Unity Screen Space Canvas Sizing Incorrectly On ARCameras

January 11, 2019 - 8:48am #1

After updating Unity to 2018.3 and Vuforia to 8.0.10, Unity's Screen Space Canvas doesn't size properly on the AR Cameras. I've tested them on normal cameras and they size perfectly for them. What appears to be happening is that the height of the screen space canvas appears to be inverted from the actual height. Closer to camera is taller, further away is smaller.

I've tried creating a new canvas after the scene is running, I've tried switching a canvas between the AR Camera and normal cameras with the exact same camera component setup (it's correct for normal cameras), and I've tried resizing the canvas.

Somehow, it appears that any camera controlled by Vuforia Behaviour is breaking my screen space Canvases.

I've attached screen shots of various configurations below.

AttachmentSize
Image icon PointOne.PNG41.04 KB
Image icon PointOne2.PNG17.73 KB
Image icon PointFour.PNG41.03 KB
Image icon PointFour2.PNG22.02 KB
Image icon One.PNG40.95 KB
Image icon One2.PNG8.02 KB
Image icon OneHundred.PNG41.2 KB
Image icon OneHundred2.PNG38.23 KB

Unity Screen Space Canvas Sizing Incorrectly On ARCameras

January 16, 2019 - 5:55am #5

So, to be clear, with the most recent version of Vuforia, Screen Space - Camera is no longer supported? We have a very specific reason to use Camera instead of Overlay in this case and it's worked in every version of Vuforia before 8.0.10.

Unity Screen Space Canvas Sizing Incorrectly On ARCameras

January 16, 2019 - 4:53am #4

You should never display UI using your game camera. This is a bad practice.

You should have a UI Camera and:

  • - set the culling mask to "UI" only
  • - set the clear flags to "depth only"
  • - Remove the culling mask "UI" from the game camera.

The screen canvas setup can vary based on your preferences and needs. In my case, the render mode is set to "Screen space - camera" and I set the UI camera as target. Add a "Canvas scaler" component, set the UI scale mode to "Scale with screen size".

Voilà, you now have total control over your UI display without interference from the AR Camera.

Unity Screen Space Canvas Sizing Incorrectly On ARCameras

January 15, 2019 - 2:56pm #3

Hello,

If you're using “Screen Space - Camera” and choosing the ARCamera, you should instead use “Screen Space - Overlay” to do Canvas UI work.

Please download our samples for best practices on Canvas UI for use with Vuforia: https://developer.vuforia.com/downloads/samples

Thanks,

Vuforia Engine Support

Unity Screen Space Canvas Sizing Incorrectly On ARCameras

January 11, 2019 - 1:07pm #2

If anyone else is having trouble with this, the only hack I've found that works is when I create a separate camera, make it cull everything and draw nothing, set all its values to match the AR Camera otherwise, and then use that for the screen space camera. Everything renders in front of the AR Camera and positions perfectly this way. It's a horrible hack, but it got the project working for now.

Log in or register to post comments