Search Unity

Hybrid camera between orthographic and perspective mode

Discussion in 'Cinemachine' started by vamky, Mar 15, 2018.

  1. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    70
    In the modern 2d fighting games with 3D scenes and characters, such as Street Fight 4, V and guilty gear XRD, one of the camera techniques applied is to use a camera that somewhere between orthographic and perspective mode. GGXRD is about 30% perspective and 70% orthographic, while SFV is about 50% vs 50%.

    Is there a way we can recreate this function with Cinemachine? Or, with custom camera shader?

     
  2. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    I had a look at the games you mentioned to refresh my memory. Each one uses variations on the techniques and approaches.

    Guilty Gear uses 2D characters in a 3D world. The camera movement gives all that great parallaxing of the environment.

    Street Fighter 4 is all 3D, with toon-ish painted textures on the characters.

    This is less than a camera thing than an art choice. 2D characters in a 3D world, or my fav - '2.5D' with mostly side-scroll type gameplay but then there's 3D corners and the like. Any of the above can be done in CM.

    Did I miss anything? Is that what you're wondering?
     
  3. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
  4. vamky

    vamky

    Joined:
    Aug 9, 2014
    Posts:
    70
    Hello Adam!

    Actually, Guilty Gear XRD is a full 3D game just as Street Fighter 4 and V.

    "For 3D to 2D projections, there are "perspective projection" in which near objects are large, distant objects look smaller, and "parallel projection" (orthogonal projection) in which such differences do not occur, but in GUILTY GEAR Xrd - SIGN - perspective projection is created with a 30% perspective and 70% orthographic hybrid camera.
    As a result, it became easier for the character to become thicker as the character approached the left and right edges, and the situation that the character loses weight in the vicinity of the center was suppressed, and it was possible to make it almost the same size at any position on the screen."

    This is a quote from a google translated technical blog post on GGXRD.

    https://translate.google.com/transl...s/216/G021678/20140714079/&edit-text=&act=url

    and the original Japanese one is here

    http://www.4gamer.net/games/216/G021678/20140714079/

    You can check various aspects of development of GGXRD from the links above.

    In contrast to most 3d games, fighting games characters need to be at the two edges of the screen rather than at the center. So when you use a perspective camera, objects at the edges become distorted. Both GGXRD and Street Fighter used this kind of hybrid camera to deal with this distortion. I know you can use a very small fov to fix this(Our game uses 18, and universal fighting engine in the asset store uses 16), but a small fov will cause other problems (objects will appears further than they should be, for example).

    That why I want to recreate how GGXRD and Street Fighter handle this problem. Hope this helps!
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,719
    Yes, the famouse Disney Multiplane Camera. However, I think what he's looking for is closer to what the Fleischer Studio did in the late 30's with the Rotograph: they built a false-perspective 3D set on a rotating table and photographed their 2D animation in front of it:

     
    Adam_Myhill likes this.
  6. Adam_Myhill

    Adam_Myhill

    Joined:
    Dec 22, 2016
    Posts:
    342
    Ah I got you, thanks for the further details @vamky , really happy to have learned more about this space.

    The wonders of optical compression - 'the camera adds 5 pounds' - it's why portrait lenses are around 85mm.. That compression is pleasing but it also pumps things up!

    I have friction over your '30% perspective, 70% ortho hybrid camera' . That description isn't clear for me, here's why.

    Cameras are either perspective or orthographic in their projection matrix. Sure, near near-infinitely small FOV in degrees on perspective lenses really closely approaches the look of ortho, heck even single digit FOV perspective lenses look pretty darn ortho but its still just a telephoto perspective lens.

    So you're really compositing characters rendered with ortho or telephoto perspective lenses onto a perspective rendered environment.

    The big question - can you do this in Unity? I haven't tried this specifically but in theory yes. You'll need two cameras, one perspective and one ortho. You'll need to set the character's Main Camera Clear Flags to 'Don't Clear', effectively rendering them with an alpha. Then you'll have to overlay both - effectively compositing the ortho characters onto the perspective background.

    That works on a static set of cameras. Now what to do when you move them? The perspective camera can't be in the same place as the ortho and the ortho camera just has radius and a direction. How to make both work together for camera movements? Perhaps I need to dig into this more.

    Things aren't going to technically 'fit' together that well but maybe in controlled scenarios like with basic movements it can be made to look ok. Obviously it works, those games are proof!

    I can't try it out just now but this is a fantastic idea.. Give it a whirl, let us know how it goes. Hopefully that helps.

    upload_2018-3-16_17-4-49.png