I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
2.1 KiB
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
- Create a Camera in your Scene. Its Render Mode defaults to Base, making it a Base Camera.
- 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
- Create another Camera in your Scene. Its Render Mode defaults to Base, making it a Base Camera.
- 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);