This page has been translated automatically.
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Setting Up Cameras

The main camera functions are available via the Camera panel: you can switch between cameras, add new cameras to the current world, open the Camera Settings window or lock the current camera.

Camera Panel

By default, there are 2 cameras in the world:

  • Game Camera that is created from the world script. This camera will always follow your player. The Game Camera can be removed via the script.
  • Editor Camera that is created from the editor script. This is the current camera of the editor.
    Notice
    Editor Camera always exists in the world.

You can also add new cameras. Such cameras can be used as watchpoints in the world: you can position the cameras in different points of the world and then switch between them via the Camera panel when it is necessary.

Notice
The number of cameras is unlimited.

Adding a New Camera

To add a new camera to the current world:

  1. Change the position and orientation of the current camera by using the navigation controls.
    Notice
    Position, orientation and settings of the current camera will be copied for the new camera.
  2. On the Camera panel, click . The new camera will be added to the list of the available cameras with the PlayerDummy_0 name.

    A new available camera
    At the same time, the camera will be added to the world as a PlayerDummy node.

    A new PlayerDummy node
  3. Change the default camera settings to the required ones.

Notice
By default, a new camera is locked . If you change the position or orientation of the locked camera by using the navigation controls, these changes will not be saved. See Positioning Camera for details.

Positioning the Camera

When the camera is locked (), you can freely move it in the current world without recording changes in its position or orientation.

If you unlock () the camera, it will return to its initial position and further movement of the camera will be recorded.

To set and save a new position and orientation for the camera by using the navigation controls:

  1. Click to unlock the camera.
    Notice
    If you don't unlock the camera, the new position and orientation will not be recorded.
  2. Place the camera to the required position and/or change its orientation by using the controls.
  3. Click to lock the camera. The position and orientation of the camera will be saved.

Also you can position the camera directly via the Nodes panel. In this case, there is no need to unlock it: the new position will be saved anyway.

Setting Up the Camera

As settings of a new camera are simply copied from the current camera, you may need to change them via the Camera Settings.

To open the Camera Settings window, choose the required camera and click on the Camera panel.

Camera Settings

The list of camera settings depends on the camera mode. The first image shows the settings of the camera in the perspective mode. The second one shows the settings in the orthographic mode.

Camera Settings
Orthographic Camera Settings
Option Description
Name Name of the current camera. If you change the camera name, the name of the node (PlayerDummy) will be also changed.
Ortho Toggles between the perspective and orthographic camera modes.
Perspective mode
Orthographic mode
Height Height of the viewing volume which is represented in the form of a rectangular parallelepiped. The width of the viewing volume will be equal to its height.
Notice
The option is available only in the orthographic camera mode (the Ortho option is checked).
Field of View (available only for the perspective mode)
Degrees Camera horizontal field of view in degrees. This is the area that can be seen in the viewport (how many degrees the camera covers).
Lens (mm) Camera lens focal length.
Clipping Planes
Near Distance to the camera near clipping plane:
  • Recommended value is around 0.1 units.
  • Lower values decrease the depth precision of the scene and cause z-fighting, flickering and moire patterns.
  • Higher values increase the depth precision. But they also cause objects in front of the camera disappear.
Far Distance to the camera far clipping plane. It directly affects the light scattering results and the sky color.
  • Recommended value is 10000 units (maximum up to 20000 units).
  • Lower values are insufficient for proper light scattering and result in dark sky color. Higher values do not grant desired depth precision.
Masks
Viewport A viewport bit mask for the camera that enables to selectively display objects, decals and lights in the camera viewport. If at least one bit matches, the object, decal or light will be rendered. The mask can be edited.
Reflection A reflection bit mask for the camera that enables to selectively display reflections from objects. The mask can be edited.
Reverberation A reverb mask for the camera determines what reverberation zones can be heard. At least one bit of this mask should match the reverb mask of the sound source and the reverb mask of the reverberation zone. The mask can be edited.
Sound A sound mask for the camera that what sound channels can be heard. If at least one bit matches the sound source mask, the sound can be heard. Each bit of the source mask specifies a sound channel. The mask can be edited.

Rendering the Camera Viewport in a Separate Window

The viewport of each camera can be rendered into the Viewport window. To open the Viewport window, choose Windows -> Viewport 1/2/3/4.

The total number of the available Viewport windows is 4. Each window is resizable.

Viewport 1

The window includes the Camera panel that provides the same functionality as the panel on the UnigineEditor Menu bar and the Resolution panel that enables to set a viewport resolution and take a screenshot.

Resolution panel

The resolution panel provides access to the following functions:

NameDescription
Viewport window resolution. Available values:
  • Free - the viewport window can be freely resized.
  • Free 5×4 - the aspect ratio for the viewport window will be 5:4 during resizing.
  • Free 4×3 - the aspect ratio for the viewport window will be 4:3 during resizing.
  • Free 16×9 - the aspect ratio for the viewport window will be 16:9 during resizing.
  • Free 16×10 - the aspect ratio for the viewport window will be 16:10 during resizing.
  • Other values directly set the viewport window resolution (window resizing won't be available).
Take a screenshot of the viewport.
Last update: 2017-07-03
Build: ()