摄像机
To see the virtual environment, we require virtual "eyes" — cameras. Cameras actually define what will be visible in the final image, the angle and distance from which it will be viewed. Virtual cameras come with a number of parameters, including the angle of view (FOV), near and far clipping planes, and the camera position and orientation. By combining the clipping planes with the camera's view angle, a visibility pyramid (or frustum) is created, and only objects within this pyramid are rendered as they are within the field of view. Objects outside this pyramid are not rendered as they are out of sight.要观察虚拟环境,我们需要虚拟的"眼睛"——摄像机。摄像机实际上决定了最终图像中可见的内容、观看角度和距离。虚拟摄像机具有多项参数,包括视野角(FOV)、近远裁剪平面,以及摄像机位置和朝向。通过将裁剪平面与摄像机视角相结合,形成可见性金字塔(或称视锥体,frustum),只有位于此锥体内的物体才会被渲染,因为它们处于视野范围内。位于锥体外的物体因不可见而不会被渲染。
For visual representation, UNIGINE uses a standard perspective projection by default. If necessary, you can switch to the orthogonal projection (it can be used for 2D and isometric visualization). You can also set the life-like camera properties such as focal length and frame size (field of view is calculated automatically).UNIGINE默认使用标准透视投影进行视觉呈现。必要时可切换至正交投影(适用于2D和等距可视化)。你还可设置逼真的相机属性,如焦距和画幅尺寸(视野角会自动计算)。
The process of displaying the virtual world involves the following three entities:虚拟世界的显示过程涉及以下三个实体:
- Camera, a structure containing two matrices: view and projection. This structure allows setting the camera parameters: FOV, near and far clipping planes, and various masks and post-processing materials. The camera then passes the parameters to the viewport that draws the image that is "seen" by the camera. The camera is bound to the character that controls the camera's position.摄像机(Camera):包含视图矩阵和投影矩阵的结构体。该结构体可设置摄像机参数:FOV、近远裁剪平面、各类遮罩及后期处理材质。摄像机将这些参数传递给视口,由视口绘制摄像机"看到"的图像。摄像机绑定于控制其位置的角色上。
- Viewport receives the camera parameters and renders the received image on the screen. In addition, it provides all functions of the main renderer, for example cube maps rendering, stereo rendering, and panoramic rendering.视口(Viewport):接收摄像机参数并将生成的图像渲染到屏幕。此外,它还提供主渲染器的全部功能,如立方体贴图渲染、立体渲染和全景渲染。
- Player is a node controlled via the input devices (keyboard, mouse, joystick). It has a camera assigned. Once a player has changed its position, its internal camera's view matrix is changed as well.玩家(Player):通过输入设备(键盘、鼠标、摇杆)控制的节点。它被分配了摄像机实例。当玩家改变位置时,其内部摄像机的视图矩阵也会同步更新。
Camera Types摄像机类型#
UNIGINE features several types of players that can be used for various reasons (they have additional parameters depending on their intended use):UNIGINE提供多种玩家类型,适用于不同场景(根据用途具有额外参数):
Player Dummy is a simple viewport into the world that has no physical properties and cannot collide with objects.Player Dummy(虚拟玩家)是一个简单的世界视口,没有物理属性且无法与物体碰撞。 | |
Player Actor is a player with a physical body (having mass, etc.) approximated by a capsule that can only walk on the ground (it can be used in shooters, for example).Player Actor(角色玩家)是具有物理体的玩家(含质量等属性),采用胶囊体近似,仅能在地面行走(可用于射击游戏等场景)。 | ![]() |
Player Persecutor is a free flying camera without a physical body that follows the target node at a specified distance (can be used, for example, for a third-person view in racing). It can collide with other objects, but cannot push or interact with them.Player Persecutor(追踪玩家)是无物理体的自由飞行摄像机,以指定距离跟随目标节点(适用于赛车游戏第三人称视角等)。它能与其他物体碰撞,但无法推动或交互。 | ![]() |
Player Spectator is a free flying camera without a physical body used to create a spectator mode. It can collide with objects but cannot push or interact with them.Player Spectator(观察者玩家)是无物理体的自由飞行摄像机,用于创建观察者模式。它能与物体碰撞,但无法推动或交互。 | ![]() |
Adding and Configuring a Camera in the Editor在编辑器中添加与配置摄像机#
You can have as many cameras as you want in a scene. Moving them around, switching between them, and using various post-processing effects can solve almost any cinematic task.场景中可以包含任意数量的摄像机。通过移动摄像机、切换不同摄像机以及应用各类后期处理效果,几乎可以解决所有影视制作需求。
To add a new camera to the current scene, do the following:添加新摄像机到当前场景的操作步骤如下:
- Orient the currently used camera as required and configure its parameters (its position, rotation, and settings will be copied to a new camera).按需求调整当前使用摄像机的朝向并配置参数(其位置、旋转及设置将被复制到新摄像机)。
-
In the Camera panel, click
. A new PlayerDummy camera with the specified settings will be added to the list of available cameras.在 Camera 摄像机面板点击
按钮,具有指定设置的新PlayerDummy摄像机将被添加到可用摄像机列表。
- Adjust the camera settings, if required.如需调整可进一步修改摄像机设置。
You can also add a new camera via the Create menu (Create → Camera → Required camera type) and then set the desired settings in the Parameters window.也可通过创建菜单添加新摄像机(Create → Camera → 所需摄像机类型),随后在参数窗口设置具体参数。
You can define for any camera whether it will be used for listening to sounds (Listener) and whether it will be set by default when the application is launched (Main Player). You can also define a set of masks that allow you to additionally control what will be heard and seen through this camera and what will be ignored (sound sources, reverberation, objects, and reflections). We'll deal with masks in more detail later.你可以为任意摄像机定义以下功能:是否作为声音监听器(Listener)使用,以及是否设为应用程序启动时的默认摄像机(Main Player)。同时还能配置一组遮罩(masks),通过这些遮罩可以额外控制该摄像机接收/忽略的视听内容(包括声源、混响、物体及反射等)。关于遮罩的具体用法我们将在后续章节详细讲解。
Additional Camera Effects附加摄像机特效#
In addition to the general settings, different post-materials can be assigned to cameras (for example, to simulate a color light filter or thermal vision), including custom ones. Moreover, you can control various standard camera effects such as depth of field, lens contamination, flare, and more via the Settings window.除常规设置外,还可为摄像机分配不同后期材质(例如模拟彩色滤光片或热成像视觉),包括自定义材质。此外,通过设置窗口可控制各类标准摄像机特效:景深、镜头污渍、光晕等。
本页面上的信息适用于 UNIGINE 2.20 SDK.