Three perspective modes of unity camera

introduce

Perspective, Orthogonal, and Custom Axis are the three projection modes of the camera in Unity.


method

Perspective projection mode: Perspective projection mode is a projection method in which the distance is large and the distance is small. The farther the object is from the camera, the smaller the displayed size will be. The perspective projection mode is more in line with the visual experience of the human eye and can produce more realistic effects. In game development, perspective projection mode is usually used for objects in the scene, such as buildings, terrain, etc.

Orthographic projection mode: Orthographic projection mode is a projection method without perspective effect, and the size of the object will not change with the distance. In game development, the orthographic projection mode is usually used for displaying 2D games or UI interfaces.

Custom axis projection mode: The custom axis projection mode is a projection method that can customize the projection direction, and the position and orientation of the camera can be customized according to the needs, so as to achieve different projection effects. In game development, the custom axis projection mode is usually used for some special scenes or effects, such as VR games, tilted maps, etc.

Generally speaking, the perspective projection mode is more in line with the real visual experience, the orthographic projection mode is suitable for 2D games or UI interfaces, and the custom axis projection mode can achieve more free projection effects.


for example

The following is an example of an Ortho mode:

Suppose we have a game on a 2D plane, and the player needs to control a block to jump, we can use the orthogonal mode to realize the camera's perspective.

First, we need to create a camera in the scene and set its Projection to Orthographic. Then, we need to set the camera's position to the player's position so that the camera will always follow the player's movement.

Next, we need to adjust the Size property of the camera, which determines the size of the camera's field of view. If the Size is set too small, the player cannot see the entire game screen; if the Size is set too large, the screen will appear blurred. We can keep trying to adjust the value of Size until we find the most suitable value.

Finally, we need to set the camera's Depth to -1, so that it will appear in front of other objects, so that the player can always see the game screen.


Guess you like

Origin blog.csdn.net/qq_20179331/article/details/130107811