shot transition from perspective to orthographic?

I'd like to transition from a cinematic intro (which uses a perspective camera) directly to gameplay (which uses an orthographic camera). Is cinemachine able to accomplish this shot?

You can't lerp from one to the other, so technically, no.

However, you can fake it with the knowledge that an ortho camera can be approximated by a perspective camera with a very very small FOV, placed far enough away so that the screen size at the target matches the screen size of your ortho camera. You can use CM to blend to that fake camera, then cut to the real ortho camera at the end, and it will approximate a believable blend.

7 Likes

Thanks for the quick, definitive and helpful response! I'll give it a shot.

I took a shot at what you suggested, Gregoryl, but wasn't able to get a smooth transition between even relatively narrow FOVs (18-20) and 1 FOV (to simulate ortho). Even using linear blends, I wasn't able to get the FOV change to layer smoothly with camera position change. So I just ended up going with a pop from perspective to ortho after the camera movement. (If this is something you've gotten to work and can offer any pointers, I'd appreciate it!)

Now I'm running into a related issue. I can't seem to get an ortho cam to co-exist in a scene with a perspective cam so that I can switch over to it for gameplay after the initial transition. I tried creating an ortho camera with a virtual brain in the scene with the perspective camera with a virtual brain. Then, when I made a virtual cinemachine camera, it had an 'orthographic size' field under lens in the inspector, so I thought it would behave as an orthographic camera, but the image it captures is in perspective.

Is it possible to have both ortho and perspective cameras with cinemachine brains in the same scene?

Getting the perspective-to-ortho blend is a little tricky, and may not work with all content. If your ortho is looking diagonally at your content then you might be out of luck, but if it's straight down or head-on you can do it with a little filddling. Import the attached and play the scene for a working example. It blends from perspective to ortho, then at the end of the blend it just changes the Camera to ortho and cuts to a properly set up ortho vcam. No need to have 2 separate cameras. You have to play the scene - the event that changes the camera mode only fires in play mode. Look at the timeline to see how it's set up.

5189138--515684--persp2ortho.gif

As for setting up with 2 cameras and 2 brains, you can do it, but there's a gotcha: the vcams themselves don't store the ortho vs perspective mode. Instead, they take that info from the Camera currently attached to whatever Brain they can be activated on. If there are 2 such brains with different settings then the results will be indeterminate.

Follow the instructions in the docs for setting up 2 Cameras with 2 CM brains. Pay special attention to the instructions surrounding the layers. Make sure that the ortho vcams can only be seen by the ortho brain, and the perspective vcams can only be seen by the perspective brain. Then the vcams will show the appropriate mode consistently,

How to set up 2 brains:


EDIT: see this post for an updated version of the demo: https://forum.unity.com/threads/shot-transition-from-perspective-to-orthographic.778298/#post-7538348

3 Likes

Actually, it works for oblique views too, I don't know why I said it might not. Here it is at 45 degrees

5190941--515918--persp2Ortho2.gif

4 Likes

Thanks for following up on this in such detail, Gregoryl!! I'll dig in with this info and let you know how I fare!

2 Likes


It was fun :)

3 Likes


Gregoryl, are you using an actual ortho cam in this shot at the end? In the package you attached above (thank you again!), the final cam is a perspective cam. The shot I'm trying to create transitions from perspective to orthographic isometric. X:30, Y:330. I'm currently looking into how I might set up the two cinemachine brain cameras (one perspective and one ortho) on layers and then switch between them after the transition so I can carry on showing gameplay from a true orthographic camera.

You need to play the scene - in play-mode - not just playing the timeline. The Camera starts out being perspective, but the ortho vcam has a behaviour on it that exposes an event handler for when the vcam is enabled. The handler changes the Camera to ortho. So yes, it's a real ortho camera, but only in play-mode because the event doesn't happen otherwise.

The idea is, when you cut to the ortho vcam, at the same time change the Camera to ortho. My event handler is just one way to do it. In your context you might want to do it differently.

1 Like

Ok, the solution is starting to emerge from the mist. :) A HUGE piece of the puzzle was finding the Cinemachine Follow Zoom Component in the package you sent. I wasn't using it before. In fact, it doesn't show up in my cinemachine components, so I copied and pasted it from your example camera. That solved the big issue of keeping the framing and composition smooth and consistent as FOV changed. It was exactly what I was looking for!!

After a couple trial runs, I determined I wasn't getting the shot I wanted by just blending between two virtual cameras. So I set up a dolly cam thinking I could just animate the FOV property on the cam as it moved along its track. I'm getting much better camera movement, but the dollycam lens doesn't seem to reflect the FOV settings in its properties. The property animates and updates correctly in the inspector and goes from 18 FOV to 1 FOV, but the shot in the game view stays in perspective. I've been fiddling with different properties to see if I can find what may be influencing or overriding the FOV, but haven't been able to get it to look like an orthographic view. Any ideas what may be causing that? Should that be a workable solution?

If I can get that piece of the puzzle in place and then follow through on the switch to true ortho cam with help from your guidance in your last post, I think I'll have my solution!

Thanks yet again for your expertise and all your help. It's been incredibly timely and is much appreciated!

You should find the FollowZoom in the Extensions dropdown of the vcam inspector. Is it not there?

5196014--516560--upload_2019-11-20_14-41-55.png

If you have a FollowZoom extension installed on the dolly vcam, then it will want to drive the FOV, so will overwrite whatever you try to animate for that field. That's its job. Why do you need to animate the FOV? Why not let FollowZoom do its thing?

1 Like

a-ha! I thought the FollowZoom was just stabilizing between two positions with different FOVs. And I was trying to add it as a component as opposed to adding it as an extension. I'm leveling up fast here! :p

This new revelation has given me a concept I need to digest... I'm not quite grocking how to set up FollowZoom to do what I need it to do. Let me try to talk it through...

I want the camera to go from an exact (close-up) perspective shot at the start of the timeline (FOV 18), to an exact (distant overhead) ortho shot at the end (FOV 0). I have the initial shot set up as the first position on a dolly track and it's looking right.

I thought what I would need to do at that point was to set the FOV on the camera to 1 at the end shot of the timeline, enable FollowZoom and then manually nudge around the second position on the dolly until it matches my ortho target (and that FollowZoom would take care of keeping the shot stable in between). But now I see I need to somehow arrive at the end shot by figuring out how far away and where the camera would need to be with FollowZoom set with max FOV 18 and min FOV 1 so that it gets the right framing when FOV 1 is triggered by distance from the target?? Am I close? :)

FollowZoom dynamically adjusts the FOV so that the world-space width of the screen plane at the target's position remains constant. The intent is to preserve the screen size of the target, regardless of the distance between the target and camera. Imagine dynamically adjusting your camera's zoom as you move the camera, to keep the target a constant size. That's what it does.

The width parameter says how big the screen rect should be, in world coords, at the depth of the LookAt target.

5196185--516569--upload_2019-11-20_15-29-43.png

In the example image, that's 2 m. This is the same concept as the ortho screen size. That's how big the screen is. So, you should set up your FollowZoom to have a width that matches the ortho screen size of your final ortho cam (it might be off a bit, because one is screen size and the other is screen half-size, or maybe one is vertical size and the other is horizontal size, I don't remember). The min and max just clamp how much the FollowZoom is willing to adjust the FOV before giving up, to avoid extreme outcomes. You don't need those in this case, so set the range as wide as possible.

So, to find the right distance for your fake ortho vcam: put the FollowZoom on it, set it up for the right width and camera angle, then start moving the vcam away until it looks right. The FollowZoom will automatically control the FOV to preserve the framing - you just want the distance to be large enough that it looks sufficiently ortho-ish.

Does that make sense?

1 Like

Yeah, I think so. Let me go see! Thanks again, G!

I thought for a moment the FOV wasn't kicking in, but I just hadn't moved the camera far enough away! (Because my camera is aimed isometrically, at such large distances it's difficult to 'zoom' it since it means translating on all three axes. Is there a way to translate the camera relative to the direction it's facing? That would be super helpful at the moment!)

So now I've got it set up so my endpoints are correct, but the dolly track is so long (to get enough distance to simulate ortho) that the Follow Zoom script seems to be having trouble keeping up and maintaining a smooth, stable focus.

Once you have the vcam aimed, you can switch your scene view to show local axes, then drag back the vcam's local Z.
You might be pushing the dolly track beyond its precision.
Maybe you could show me some pictures of your setup. It's getting hard for me to visualize.

1 Like

Thanks, Gregory. Switching to local axes was exactly what I was looking for. Right in front of me!

I think you're right. I may be pushing the dolly track beyond its precision. I'm not sure if these shots help clarify. I can send you more specific details non-publicly if you're interested and able to take a look. I recognize I've already soaked up a lot of your time! Thank you again!

5199377--516977--2019-11-21_1235.png

5199377--516980--2019-11-21_1238.png

5199377--516983--2019-11-21_1245.png

Looks like you're just making a linear transition from your start vcam to your fake ortho. If I were you I'd get rid of the dolly track, get rid of the animator, set up a static FakeOrtho vcam where your dolly rack currently ends and just let CM blend to it. It will give the same result but without the complexity. You don't even need the timeline - just activate the fake ortho and let CM blend it in. If you want to make a custom blend curve to control the timing then you can set that up in the CM brain.

If the setup that I'm suggesting (which is essentially what I sent you in the project) is not giving the results you expect, we can look into it.

1 Like

Thanks, Gregory. I'll give that a shot. Stay tuned!