Table of Contents

Render Target Asset

A Render Target asset is a 2D texture that has no source image. Instead, it is filled by rendering into it at runtime, for example by a camera that renders the scene from a certain viewpoint. Render targets can be used everywhere a 2D texture can be used, so materials can reference them and display their content, for instance on a monitor that shows the view of a security camera.

Rendering Into a Render Target

  1. Create a render target asset and choose its format and resolution.
  2. Add a camera component to the scene, set its UsageHint to Render to Texture and select the render target asset as its RenderTarget. The camera also needs a CameraRenderPipeline. RenderTargetOffset and RenderTargetSize allow you to render only to a part of the texture.
  3. Reference the render target asset in a material, and use that material on the object that should display the image.
  4. Add a Render Target Activator component to the object that displays the image and select the same render target asset.

The camera only renders into the render target while it is activated. Rendering a view costs as much as rendering any other view, so the engine skips it, unless something requests it. The Render Target Activator component does this: whenever it is visible in the main view (or in an editor view), it activates all cameras that render into its render target for that frame. That means the render target is only updated while the object displaying it is on screen. Visibility is determined with a small bounding sphere at the position of the owner object, so place the component close to the center of the surface that displays the image. Visibility in other views, such as shadow views, doesn't activate the render target.

Asset Properties

Format: The format of the texture:

  • RGBA8 sRGB, RGBA8: 8 bit per channel, either for colors (sRGB) or for linear data.
  • RGB10: An HDR format with 11 bit for red and green and 10 bit for blue, without alpha.
  • RGBA16: An HDR format with 16 bit float per channel.
  • R8, R16, R32, RG8, RG16, RG32: Single and dual channel formats. 8 bit formats store normalized values, 16 and 32 bit formats store floats.

Resolution: The dimensions of the texture. The fixed resolutions range from 64x64 to 2048x2048. If set to CVar RT Resolution 1 or CVar RT Resolution 2, the resolution is read from the CVar Rendering.Offscreen.TargetResolution1 (default 256) or Rendering.Offscreen.TargetResolution2 (default 512). This can be used to adjust the resolution through quality settings. The CVar is read when the render target is loaded, changing it later doesn't affect render targets that are already loaded.

CVarResScale: If the resolution is read from a CVar, the value is multiplied with this factor, for instance to create a half resolution render target. The result is rounded up to a multiple of 8 and clamped to the range 8 to 4096.

Filtering, AddressMode: Behave as for 2D textures.

Render targets are always square.

See Also