Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Positioning Cinemachine's Gate in the Vertical Centre of Portrait Screen

Discussion in 'Cinemachine' started by ferretnt, Aug 20, 2020.

  1. ferretnt

    ferretnt

    Joined:
    Apr 10, 2012
    Posts:
    412
    Hi (hopefully) Gregory,

    [Edit: I think, looking at the screenshots I posted, and from some further debugging, that this all actually works correctly and that Cinemachine is vertically centering the camera gate, but the debug draw of the camera gate is in the wrong place!]

    [Edit2: I think this was fixed sometime between 2.3.4 (the 2019-verified package) and 2.6.1. Using 2.6.1 appears correct.]

    I am trying to use Cinemachine for some NIS shots on our mobile game, and match them, across devices, to how our non-cinemachine shots are set up.

    We're using physical cameras, with a horizontal gate fit, and without Cinemachine Unity fits that gate in the centre of the screen vertically. Our shots are framed using a square aspect, and then overscanned to fill the screen vertically on different devices (the app is a mobile, portrait format game, but for example an iPad at 4x3 and an iPhoneXS at 18:9 will have quite different vertical extents, but the same horizontal extent, and always displaying exactly the same image in the centre square of the screen. )

    So, consider the following shot set up without Cinemachine (shown both as its game view and scene view with the camera gate debug lines, in both Square aspect gameview and 9:16 portrait. You can see that the 9:16 portrait version includes the square subsection, exactly, in the centre of the screen vertically, with additional detail visible top and bottom in the 9x16 view.

    RegularCam9x16.jpg RegularCamSquare1x1.jpg
    However, if we try to do the same thing with a Cinemachine shot, when framing the shot with the square camera everything looks good, BUT because Cinemachine fits the gate of the camera to the top of the screen, not the middle, the 9x16 portrait view is translated to the top of the screen, and there is only extra detail visible at the bottom:

    CinemachineCamSquare.jpg CinemachineCam9x16.jpg
    Is there a way to have Cinemachine treat the gate of a physical camera (with horizontal gate fit) considered in the middle of the screen vertically rather than the top?

    Any help gratefully appreciated. Cinemachine offers a lot of controls, so I'd rather not just start fiddling with things like Composer.ScreenY without understanding what we're doing and what the consequences might be. Specifically, we want the settings that we modify to have no effect on Cinemachine (i.e. it should always choose to frame exactly the same shot in the centre of the screen for any device (portrait) aspect ratio - the only thing that should change is how much additional vertical extent is added top and bottom.

    I didn't take a screenshot of it, but of course *without* a physical camera the gate is always fitted to the centre of the screen (although of course that is required because the gate's aspect always exactly matches the camera's aspect.)

    Thanks,
    Alex
     
    Last edited: Aug 20, 2020
    Gregoryl likes this.