Camera

The Camera in a game is the main tool used to capture Scenes. The visible range of the Camera is controlled by adjusting camera-related parameters. The Camera is represented as follows in the Cocos Creator editor:

camera

The Camera‘s visual range is composed of 6 planes forming a Frustum, a Near Plane, and a Far Plane to control the visible distance and range of near and far distance, at the same time, they also constitute the size of the viewport.

camera view

To use Camera, please refer to the Camera API.

Camera components

The Camera Component is an important functional component that we use to present a Scene.

camera component

ParameterDescription
ClearFlagsCamera clear logo. Contains:
DONT_CLEAR: not clear;
DEPTH_ONLY: only clear the depth;
SLOD_COLOR: clear the color, depth and template buffer
ColorClear the specified color
DepthClear the specified depth
StencilClear the specified template buffer
FarFar cutting distance
NearNear cutting distance
FovAngle of view
OrthoHeightThe height of the orthogonal Camera
PriorityPriority. High-priority Cameras will be rendered first in the rendering process
ProjectionProjection mode. Divided into perspective projection (PERSPECTIVE) and orthogonal projection (ORTHO)
RectViewport size of Camera
VisibilityThe visibility of the Camera. Used to control the visibility of different models in the same Camera.

Camera group rendering

The Camera‘s group rendering function works with the Model Component through the Visibility property of the Camera Component. The user can set the Visibility value through code to complete the group rendering. It should be noted that the Visibility value is bitwise comparison, and the user can manipulate the top 20 bits of Visibility through bit operations to complete the grouping.

The Camera and models provided by default are all rendered without grouping. You do not need to change this value if the game has no special requirements to do so.