Version: Unity 6 (6000.0)
Language : English
Apply different post processing effects to separate cameras in URP
Create a render request in URP

Render a camera’s output to a Render Texture in URP

In the Universal Render PipelineA series of operations that take the contents of a Scene, and displays them on a screen. Unity lets you choose from pre-built render pipelines, or write your own. More info
See in Glossary
(URP), a CameraA component which creates an image of a particular viewpoint in your scene. The output is either drawn to the screen or captured as a texture. More info
See in Glossary
can render to the screen or to a Render TextureA special type of Texture that is created and updated at runtime. To use them, first create a new Render Texture and designate one of your Cameras to render into it. Then you can use the Render Texture in a Material just like a regular Texture. More info
See in Glossary
. Rendering to a screen is the default and is the most common use case, but rendering to a Render Texture allows you to create effects such as CCTV camera monitors.

If you have a Camera that is rendering to a Render Texture, you must have a second Camera that then renders that Render Texture to the screen. In URP, all Cameras that render to Render Textures perform their render loops before all Cameras that render to the screen. This ensures that the Render Textures are ready to render to the screen. For more information on Camera rendering order in URP, refer to Rendering order and overdraw.

Render to a Render Texture that renders to the screen

  1. Create a Render Texture Asset in your project. To do this select Assets > Create > Render Texture.
  2. Create a QuadA primitive object that resembles a plane but its edges are only one unit long, it uses only 4 vertices, and the surface is oriented in the XY plane of the local coordinate space. More info
    See in Glossary
    game object in your sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
    See in Glossary
    .
  3. Create a material in your Project.
  4. In the InspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
    See in Glossary
    , drag the Render Texture to the material’s Base Map field.
  5. In the Scene viewAn interactive view into the world you are creating. You use the Scene View to select and position scenery, characters, cameras, lights, and all other types of Game Object. More info
    See in Glossary
    , drag the material on to the quad.
  6. Create a camera in your scene.
  7. Select the Base Camera and in the Inspector, drag the Render Texture on to the Output Texture property.
  8. Create another camera in your scene.
  9. Place the quad within the view of the new Base Camera.

The first Camera now renders its view to the Render Texture. The second Camera renders the scene including the Render Texture to the screen.

You can set the output target for a camera in a script by setting the targetTexture property of the camera:

myCamera.targetTexture = myRenderTexture;
Apply different post processing effects to separate cameras in URP
Create a render request in URP