|
I am fiddling with the idea of implementing smooth camera transitions from ortographic to perspective mode. I think this would make for a cool effect in my videogame. I assume that the values involved in the interpolation would be 'ortographicSize' and 'fieldOfView'. I plan on modifying those two variables in the Update method, by using Interp or SmoothDamp or any other similar function to smooth out the values. But, how can I correspond ortographic mode's 'size' to perspective mode's 'fieldOfView'? Is there any actual relationship between them that can be calculated? I notice that decreasing the fieldOfView actually makes the perspective camera become more and more ortographic, while at the same time zooming in. But I don't want it to zoom in, I just want things to appear gradually flatter.
(comments are locked)
|
|
What you really want is the 'trombone effect'. Use a perspective camera, but 'fake' the ortho view by using a very small fieldOfView and set a long distance away. Then interpolate over time the fieldOfView to something normal like 60 and closer distance (or vice versa for reverse effect). It goes something like this (my code is more complex so I'm just snipping the math out here. I know, and thanks for answering BTW, but I still don't know how to match a certain 'fieldOfView' with how much zoom out I should do to compensate. I don't want the camera to zoom in or out when changing the fieldOfView.
Apr 14 '11 at 07:46 AM
Aurelio Provedo
You'll need to computer the camera view unit in world unit and modify the field of view as you animate the camera position so that the view unit/world unit ratio stays the same.
Apr 14 '11 at 07:57 AM
Jean Fabre
That is great, Jean Fabre. Thank you. But how can I calculate that? What are the variables for finding that ratio? Maybe I could get the camera's 'cameraToWorldMatrix' and then use MultiplyPoint() to get the world extents of the camera... I think I'm going to spend a good while studying math about projection matrices right now ;-) Oh, and post an answer instead of a comment, so I can upvote you.
Apr 14 '11 at 09:38 AM
Aurelio Provedo
Posted code, above
Apr 14 '11 at 05:11 PM
DaveA
What is variable 'd' for?
Apr 15 '11 at 06:39 AM
Aurelio Provedo
(comments are locked)
|
|
I found this code at the forums and it works like a charm: http://forum.unity3d.com/threads/32765-Smooth-transition-between-perspective-and-orthographic-modes
(comments are locked)
|
