Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Smoothly transition from orthographic projection to perspective projection?

I'm developing a game that consists of 2 stages, one of these has an orthographic projection, and the other stage has a perspective projection.

Currently when we go between modes we fade to black, and then come back in the new camera mode.

How would I go about smoothly transitioning between the two?

like image 448
Jackson Rushing Avatar asked Feb 08 '17 19:02

Jackson Rushing


People also ask

How is orthographic projection different from perspective projection?

Perspective viewpoints give more information about depth and are often easier to view because you use perspective views in real life. Orthographic viewpoints make it much easier to compare two parts of the molecule, as there is no question about how the viewpoint may affect the perception of distance.

Why is perspective projection more realistic?

Perspective projection is more realistic since distant objects appear smaller.

What is 3D to 2D projection?

For a 3D-to-2D projection, there is a finite plane on which the world is projected. For 2D to 1D, there is a bounded line that is the result of the projection. An orthographic projection is a very simplistic projection.


1 Answers

There are probably a handful of ways of accomplishing this, the two I found that seemed like they would work the best were:

  1. Lerping all the matrix elements from one matrix to the other. Apparently this works pretty well all things considered. I don't believe this transition will appear linear, though. You could try to give it an easing function instead of doing the interpolation linearly

  2. A dolly zoom on the perspective matrix going to/from a near 0 field of view. You would pop from the orthographic matrix to the near 0 perspective matrix and lerp the fov out to your target, and probably be heavily tweaking the near/far planes as you go. In reverse you would lerp to 0 and then pop to the orthographic matrix. The idea behind this being that things appear flatter with a lower fov and that a fov of 0 is essentially an orthographic projection. This is more complex but can also be tweaked a whole lot more.

like image 152
Robert Rouhani Avatar answered Oct 12 '22 00:10

Robert Rouhani