View on GitHub

ezEngine Documentation

The documentation for ezEngine

Camera Component

The camera component is used to tell the renderer from which position and with which settings to render the scene. Apart from the component that acts as the main camera, there can be additional cameras in active use for render to texture (TODO) effects. Additionally, camera components can be used in the editor as ‘bookmarks’ to be able to quickly jump to specific positions in a level.


When an object with a camera component is selected, the editor shows a preview of what the camera sees in the top left corner.

Main Camera

The camera settings that are used for rendering the scene are fully under control of the game state. Every frame it decides where to place the main camera and with which settings. At this point, no camera component is involved, your game may control the main camera without having any camera component in the scene.

However, the default behavior of the game state (see ezFallbackGameState), is to check the scene for a camera component that has its UsageHint set to Main View. Unless you write a custom game state and override this behavior, the game state will simply copy all the camera settings from the first camera component that it can find with this usage hint.

Consequently, you can control the main camera, by placing a component and setting its UsageHint to Main View.

If you want a different camera component to take over from the current one, you need to change the usage hint on those camera components.


The ezFallbackGameState is mostly for development and therefore has other convenience features for cameras. For example, you can switch through cameras in the scene using Page Up and Page Down. If you release a game, you should make sure to disable this behavior.

Other Cameras

A scene can contain any number of camera components. Unless they are referenced by other systems, they won’t do anything and will have no performance impact.

Camera Bookmarks

Camera components can be placed as ‘bookmarks’, such that people working on a scene can quickly move the editor camera to areas of interest. This chapter describes how to do so.

Include/Exclude Tags

By default a camera renders all objects in the scene. Sometimes it can be desirable, though, for a camera to render only specific objects, or to ignore those. For example you may have descriptive labels attached to some objects, which the player can display on demand.

Using the inclusion and exclusion tags on the camera, you can control which objects are going to be considered for rendering from this camera view.


Don’t forget that tags are not inherited. You can’t hide an object by setting a tag on its parent node.

So for the example with the object labels above, you would assign a ‘label’ tag to those objects and on your camera you would set ‘label’ as an exclusion tag. This way those objects are not rendered. When the player wants to see the labels, you would simply remove the exclusion tag from the camera, to make them appear.


Especially when using include tags, be aware that not only meshes, but also light sources (and everything else that’s part of the rendering process) are affected by this. If you forget to set the necessary include tags on your light sources, the output will stay dark.

Render to Texture

Camera components can be used to render their view to a texture, which can then be referenced by a material and displayed on any mesh.

To enable this mode, the UsageHint has to be set to Render to Texture. You also need to select a CameraRenderPipeline. The render pipeline defines how the scene is rendered and which rendering effects are applied. You need to configure which render pipelines (TODO) are available to the cameras in the asset profiles (TODO).

The RenderTargetOffset and RenderTargetSize allow you to render only to a part of the texture.

Note that rendering to a texture involves additional steps. See the chapter about render-to-texture (TODO) for full instructions.

Component Properties

See Also