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

Customize Render Texture

Render Texture is a texture that shows what the camera is looking at. You can apply this texture to an image or use it as a normal texture resource.

↓ Camera_RenderTexture_Brush.zip

Built-in Render Texture

The default Camera object in the scene uses a built-in Render Texture called Final Render Output. This Render Texture uses the webcam video frame by default, so it shows what the webcam or the phone’s camera is viewing.

Tip
Tip

What you see in the Preview window matches the Final Render Output Render Texture.

Create a Render Texture

You can create a new Render Texture by clicking + Add Asset > Texture > Render Texture at the bottom of the Assets panel.

Apply Render Texture to a Camera

Drag the newly created Render Texture from the Assets panel to the Camera component’s Render Texture property in the Inspector panel. This render texture shows what this camera is viewing right now.

Display Render Texture onto an Image

To display the camera’s view, you can create an image by clicking + Add object > 2D > Image.

Select the Image and navigate to the Inspector panel. Then change its Texture to the Render Texture you assigned to the Camera.

You should notice that the image seems to have disappeared from the Preview view. This is because the Render Texture you created has a default Input Texture which is the default webcam view. Now, it is the same with Final Render Output.

To see the difference, you can add a sphere from + Add object > 3D > Sphere to the scene that is set up to the Layer that this Camera(Default Layer) is taking care of, but the 2D Camera (Layer 1)is not. Now, move the image around, and you’ll see the Sphere is only shown in the image.

Customize Input Texture

When creating a new Render Texture, it has a default Input Texture. The default is the camera view which is shown as None. You can assign an image texture as the Input Texture to cover the original camera input. Try to replace the texture with one of the built-in textures: Background Texture.

You should see the image rendering the BackgroundTexture below the virtual object now. You can resize the image and move it around.

You can also use Input Texture with transparency to allow the camera view to show instead of fully covering the camera rendering.

Fill Render Texture with Color

Customize Camera’s Clear Type and Clear Color

In addition to replacing the camera view with an image, you can also fill the render texture with a plain color.

Select the Camera in the Hierarchy View. Navigate to the Inspector panel, set Clear Type of the Camera component to Color, Depth color, or Color depth stencil. The Render Texture of this Camera will be filled by the Clear Color you set up. See AR Camera for more information on Clear Type.

Demo effect: Brush

↓ Camera_RenderTexture_Brush.zip

Keep the Input Texture of the Render Texture as None. Set the Clear Type of the Camera component to Depth, Don’t, or Depth Stencil.

Then try to drag the cube you created in the scene. You will see the movement trails stay on the render texture.

Tip
Tip

If you set the Clear Type of the Camera component to Depth, Don’t, or Depth Stencily you’ll be able to see these trails.

To understand the Clear Type differences between Depth and Don’t, put a plane intersecting with the cube, and then move the cube through the plane.

If you set the Clear Type of the Camera component to Don’t, you will see that when the cube intersects with the plane, there is a movement trail because the Don’tClear Type does not clears the depth buffer from a previous render texture.

If you set the Clear Type of the Camera component to Depth. You’ll find when the cube intersects with the plane, there is no movement trail because the Depth Clear Type clears the depth buffer from a previous render texture.

It will recalculate the depth between intersected objects and then redraw the new render texture.

Render Texture properties

  • Input Texture: You can use the original web camera/device camera view as the input, which is the default, or assign a texture to render the virtual scene with the original camera render.
Tip
Tip

If the Clear Type of the Camera component assigned with this Render Texture has been set up to Color or Depth color or Color depth stencil, the Render Texture of this Camera will be filled by the Clear Color.

  • MSAA: Multisample anti-aliasing (MSAA) is a type of spatial anti-aliasing. This is a process for reducing aliasing at the edges of rasterized primitives.
    • None
    • 4X

Advance

  • ColorFormat: The color format of render texture. This property determines how colors get stored. Each color has a Red, Green, Blue channel, and maybe an Alpha channel.
    • RGBA8Unorm (Default)
    • RGB16Sfloat
    • RGB32Sfloat
    • RGB8Unorm
    • RGBA16Sfloat
    • RGBA32Sfloat
    • RGBA8Unorm
  • Enable Mipmap: When rendering textured objects in 3D scenes, GPU can use different approaches to determine how much of a texture’s detail is visible to the camera. Mipmaps are commonly used for rendering textured objects based on their distance from the camera to achieve a good balance between quality and performance. If checked:
    • Filter Min
      • Linear (Default)
      • Nearest
    • Filter Mag
      • Linear (Default)
      • Nearest
    • Filter Mipmap
      • None(Default)
      • Linear
      • Nearest
    • Wrap Mode STR three values are the same.
      • Clamp (Default)
      • Repeat
      • Mirror