Search Unity

Screen position out of view frustum - is this caused by Cinemachine?

Discussion in 'Cinemachine' started by pitchblende, Apr 3, 2021.

  1. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    I'm using a Cinemachine camera as my main camera (well, the Brain is on my main camera but I'm using a CinemachineVirtualCamera as a Follow Camera). I have a typical UI Canvas in Screen Space - Overlay mode.

    When editing the Canvas in 2D mode I'm getting the following errors spammed into the Console repeatedly:

    Screen position out of view frustum (screen pos 256.000000, 0.000000, 1566152.250000) (Camera rect 0 0 256 256)

    These seem to be coming from the function Camera::ScreenToWorldPoint.

    If I zoom in enough so that the Z component of the screen pos is < 10,000, the errors go away, however I am so far zoomed into the scene that my UI is not visible because I'm only looking at a very tiny part of it.

    So I have to be zoomed out to about Z=130,000 to see my UI full-screen in the Scene view.

    I'm not entirely sure this is related to Cinemachine but I can't find any resolution to this so I'm wondering if anyone here might know how to solve this problem?

    I'm using Unity 2020.2.2 and Cinemachine 2.7.3.
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    Screen Space Overlay should be unaffected by camera position in the world, so I don't understand why you have to move your camera in order to see the canvas.

    Such large numbers on the camera's position are unusual would indicate to me that something is wrong with your setup. I doubt that it's related to Cinemachine, but just for completeness, can you post an image of your vcam inspector?
     
  3. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    Thank you for responding, Gregoryl. Sorry for the delay in responding, I didn't have email notifications enabled (EDIT: turns out I did but the email ended up in another folder - never mind).

    Well, I only have to move my camera in the Editor, and hitting 'F' moves it to the necessary location, it just happens to be 130,000 units on Z.

    Here's my vcam inspector:
    upload_2021-4-10_23-50-54.png

    Also, my main camera:
    upload_2021-4-10_23-49-24.png

    I'm a bit suspicious of that "Aim" = "Composer" warning - I don't think that was an issue with Unity 2018, I think it only occurred after I upgraded to 2019 or maybe 2020 a little after that, but this Screen Position issue is a lot newer than that, I think. Just saying it might be a red herring, but if you think it might be a cause please let me know (I've updated from 2018 to 2019 to 2020 in the last ~4 months).

    For context, the cameras are on a "Core" object which is at scene root:
    upload_2021-4-10_23-55-4.png

    Here's my Canvas inspector (Canvas object is also a direct child of "Core"):
    upload_2021-4-10_23-57-52.png
     
    Last edited: Apr 11, 2021
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    This is not related to Cinemachine. When you create a canvas in Unity, it creates this huge thing at the origin. F causes the scene view camera to frame the current thing selected in the hierarchy. The camera has to go far back in order to frame the huge thing.

    To make the Cinemachine warning go away, select "Do Nothing" in the vcam's "Aim" dropdown.
     
  5. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    Do you have any idea why this canvas is so large? Is that just how things are?

    Thanks for the tip about the warning - I'll do that provided I can still set the Lookahead, Dead Zone etc. I'm using "Follow" but not "Look At" - I assume it'll still look at the thing it's following? This is something that changed after Unity 2018 and I was never sure how to update it.
     
  6. pitchblende

    pitchblende

    Joined:
    Jan 9, 2020
    Posts:
    71
    In case it helps anyone else, I finally figured out what was causing the "Screen position out of view frustum" error in my original question - it only happens when I'm in "2D" scene mode, and it was the use of a Water plane (Water Pro Daytime from the Unity Standard Assets pack) directly perpendicular to this plane (i.e. perfectly level). If I disable the water, or rotate it a very slight amount (0.00001 degrees) around the X axis, the error ceases to appear.

    So confirmed - nothing to do with Cinemachine. I appreciate that the Standard Assets are not technically supported by Unity 2020.x but I thought I'd report back anyway.
     
    Gregoryl likes this.