Search Unity

Cinemachine Composer Not Targeting Correctly

Discussion in 'Cinemachine' started by gww2, Sep 10, 2018.

  1. gww2

    gww2

    Joined:
    Jan 13, 2017
    Posts:
    21
    I'm working on a vcam setup for tracking two creatures fighting. The virtual camera does not appear to actually target the targetgroup position, instead it seems to be offset towards one creature or the other.

    Here is what the active virtual camera shows
    upload_2018-9-10_13-25-52.png

    The actual transform position however is clearly further left:
    upload_2018-9-10_13-26-29.png

    Here is my virtual camera settings as well:
    upload_2018-9-10_13-28-10.png

    I'm currently running 2.2.7.
     
  2. gww2

    gww2

    Joined:
    Jan 13, 2017
    Posts:
    21
    For now I've rolled back to the asset store version (2.1.10) as that seems to work as expected. Would love to figure out whats going on with this so we can take advantage of cylindrical blend hints for transitions.
     
  3. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    The old (2.1.10) group composing algorithm simply framed the bounding box of the group. The bounding box was the smallest box (aligned to the camera's axes) that could enclose all the members of the group, taking into account their radii. This generally worked, except that when the group members were at different depths it could produce lopsided results.

    The new (2.2.x) group composing algorithm is more sophisticated, and tries to center the group's bounds in screen-space. To do this it considers the screen-space square that bounds the group (taking member radii into account). The center of the bounding box is not considered. Looking at your image, that appears to be what's happening. The box around the characters is nicely framed.

    If this is not the behaviour you want, you can try to adjust the radii of the members in your target group (what are they set to now?). Or, instead of using the group composer you can use a normal composer that looks at the group. That will use the group center as the LookAt point.
     
  4. gww2

    gww2

    Joined:
    Jan 13, 2017
    Posts:
    21
    That explains the behavior we're seeing.

    The radii are set based on the bounding boxes of the creatures, which are player generated so can be wildly different values.

    With the normal composer we lose the dolly/zoom to frame the fight, which makes it a no go for us as the creatures are constantly moving and we need the camera to pull in/out to capture the action.

    Its a bit frustrating that we lose the control of the targeting if we want framing.
     
    xdkSPG likes this.
  5. gww2

    gww2

    Joined:
    Jan 13, 2017
    Posts:
    21
    Another composer issue in 2.1.10 is that the framing dolly/zoom ignores the target offset.

    Would really like to be able to upgrade to 2.2.7 for the blend hint transitions still, is there any way to override the framing center target in the group composer?
     
    JohnTomorrow and xdkSPG like this.
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    @gww2 Actually it's possible to use CM 2.2.7 with the old group composer installed as a custom CM component. I've attached here the GroupComposer from 2.1.10, renamed to "NaiveGroupComposer". Just drop it into your project assets, and it will appear as an option in the vcam's Aim menu:

    upload_2018-9-24_14-33-17.png

    Let me know if it helps.
     

    Attached Files:

  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,728
    Good question. In fact the group composer ignores the group center, and frames the group in screen space according to the bounding box of the group. In the current implementation, the target offset is ignored because it's expressed in world space and it's not really clear how it should be interpreted when framing the group's bounds in screen space.

    Can you describe the behaviour you would expect to see when a nonzero target offset is specified?
     
  8. gww2

    gww2

    Joined:
    Jan 13, 2017
    Posts:
    21
    Thanks for the naivegroupcomposer, does exactly what we needed it to.

    I agree that world position target offset doesn't make any sense in the 2.2 group composer implementation. I could see how a screen space offset might work, but I can't think of any actual use case for that off the top of my head.

    Things get complicated in trying to use the new group composer in a system with continual transposer logic based on the target group, especially if you take the cameras current world position into account.

    The group composer effectively takes over the aiming target and some of the transposer control. Any transposer rule about where to place the camera relative to the target group position will be altered/overridden by the framing portion of the group composer (it will pull/push the camera away from a point that we do not have access to in the tranposing step). I'm not sure there is a clear resolution to this except to not use a transposer that will position the camera relative to the target group if you want to use the 2.2 group composer framing.

    Our system was particularly bad because it was compounded by taking the previous camera position into account in the transposer to prevent a fast moving target group from swinging the camera around too fast. With the framing logic based on the previous frame size instead of the current camera position relative to the new group position, it would cause the camera to skip around side to side as the creatures rotated towards and away from the camera position.