Rendering from multiple Cameras to the same render target | Universal RP | 10.0.0-preview.26
docs.unity3d.com
    Show / Hide Table of Contents

    Rendering from multiple Cameras to the same render target

    In the Universal Render Pipeline (URP), multiple Base Cameras or Camera Stacks can render to the same render target. This allows you to create effects such as split screen rendering.

    If more than one Base Camera or Camera Stack renders to the same area of a render target, Unity draws each pixel in the overlapping area multiple times. Unity draws the Base Camera or Camera Stack with the highest priority last, on top of the previously drawn pixels. For more information on overdraw, see Advanced information.

    You use the Base Camera's Output Target property to define the render target, and the Viewport Rect property to define the area of the render target to render to. For more information on viewport coordinates, see the Unity Manual and API documentation.

    Setting up split screen rendering

    Setting up split screen rendering in URP

    1. Create a Camera in your Scene. Its Render Mode defaults to Base, making it a Base Camera.
    2. Select the Camera. In the Inspector, scroll to the Output section. Ensure that Output Target is set to Camera, and change the values for Viewport rect to the following:
      • X: 0
      • Y: 0
      • W: 0.5
      • H: 1
    3. Create another Camera in your Scene. Its Render Mode defaults to Base, making it a Base Camera.
    4. Select the Camera. In the Inspector, scroll to the Output section. Ensure that Output Target is set to Camera, and change the values for Viewport rect to the following:
      • X: 0.5
      • Y: 0
      • W: 0.5
      • H: 1

    Unity renders the first Camera to the left-hand side of the screen, and the second Camera to the right-hand side of the screen.

    You can change the Viewport rect for a Camera in a script by setting its rect property, like this:

    myUniversalAdditionalCameraData.rect = new Rect(0.5f, 0f, 0.5f, 0f);
    
    In This Article
    • Setting up split screen rendering
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023