Skip to main content
TikTok Effect House Platform Logo
Download
Log in
Camera

Use multiple cameras

A scene can have multiple Camera objects. Multiple cameras can render out the scene. You can also use a webcam or phone camera stream on the same or different render textures.

Add Camera objects

You can add a Camera by selecting the +Add object > Scene > Camera from the Hierarchy panel. You can see your scene render in the Preview window. To learn more about how to configure a Camera object, check out Camera.

Configure Auto Sorting, Render Layer, and Render Order

To render objects on top of or in front of other objects, you can configure Auto Sorting, Render Layer, and Render Order to achieve desired effect result.

Auto Sorting

When Auto Sorting is checked, the Render Order of objects that are rendered by one camera will be determined by the order of objects in the Hierarchy panel. The object on the bottom will be rendered on top.

For example, Face Mask is rendered under the 3D Face object in the following setup.

unaligned-image-0
unaligned-image-1

In this example, Face Mask is rendered on top of the 3D Face object in the following setup.

unaligned-image-0
unaligned-image-1

Layers

Layer is set up for cameras to render objects that are attached to their selected layers.

In some cases, you may want to display a group of objects on top of or in front of another group of objects. You can use multiple cameras to render separate groups of objects in different orders by setting their Layer.

Tio
Tio

Only the object with a Mesh Renderer component can be assigned to a layer. Each camera in the scene can be assigned to render one or more of those layers. Initially, every object is assigned to the Default Layer.

Set Layer

For a camera

Camera components are also set to render the Default Layer upon creation. You can change this by selecting a new layer or multiple layers from the dropdown list. The camera will then render every object that is assigned to the selected layers.

For a scene object

You can select which layer you want this object to be on.

Tip
Tip

Make sure you have one camera’s layer set up to the same layer this object is on. If not, this object will be invisible from the render result.

Rename the Layer

By default, there are 63 layers in a new effect. We can assign them new names by double-clicking the name in the dropdown menu.

Render Order

Render Order controls the render order within this Camera‘s render texture. This property determines which camera will render first and on top of the others. A lower value Render Order will render first. Higher values will render on top of lower values.

Let’s look at an example. In this scene, we have 3D Face and Face Mask.

Both 3D Face and Face Mask use the same Camera, but we want the Face Mask to always render on top of the 3D Face shape. Right now, our scene looks like this:

First, you need to assign our 3D Face to Layer 1 and Face Mask to Layer 2. Then duplicate the Camera, and assign the first camera to render Layer 1 and the second camera to Layer 2.

Because we want 3D Face to render underneath Face Mask, we change the value of the Render Order of Camera for 3D Face to be lower than the value of the Render Order of the Camera for Face Mask.

After refreshing our Preview window, we can see the new order.

Tip
Tip

If camera A’s render order is 3, in order to make camera B be rendered on top of camera A’s rendering result, we should set camera B’s render order > 3.

Tip
Tip

You can also utilitize Auto Sorting. Using one Camera, drag the Face Mask object to the bottom of the Hierarchy panel. This will render the Face Mask on the top of 3D Face.

Usage 1: 3D (Perspective) Camera + 2D (Orthographic) Camera

When a Camera oject selects the same render texture with different layers, the selected render texture will show views of both Cameras. This approach is most commonly used with a Perspective Camera for 3D objects and an Orthographic Camera for 2D views

unaligned-image-0
unaligned-image-1

Usage 2: Add 3D objects in front of or behind the segmentation

You can add 3D objects in front of or behind the segmentation layer by changing the render order of the cameras or by manipulating the layers of each object. Feel free to check out Segmentation for more details.