Render same stuff to two displays

Hi everyone, can’t seem to find an answer to my problem, even if it doesn’t seem like much of an issue. I’ve been trying to render the same game on two different displays without success. Got my canvases on screen space-camera mode, so I can’t enable a second camera to render to display 2. In my case I sometime have to disable a canvas and enable another one to change page, and the second canvas doesn’t get rendered if using Screen space-overlay mode or world space mode. Isn’t there an easy way to do this?

You need 3 cameras to do this. You basically render to a virtual canvas with the main camera and then capture that canvas with two more cameras. Just like current blockbuster movies end up on illegal streaming websites right after they are released.

  • Create a new material with the “Unlit/Texture” shader.
  • Create a new render texture. You have to set the display resolution in this texture. If both displays have different resolutions use the bigger one. It will cause even bigger (solvable) problems if the displays have a different aspect ration. But the bigger problem there would be that you are trying to use the same UI for two different aspect ratios.
  • Set that texture as the render texture in your main camera and as the texture in your unlit material.
  • Add a quad GameObject and select the material with the render texture in the mesh renderer.
  • Create a new layer. Something like “IndirectCameras”.
  • Put the Quad into that layer.
  • In the culling mask of the main camera deactivate the layer “IndirectCameras”.
  • Add two (or more) new cameras. With those cameras …
  • … ONLY activate “IndirectCameras” in their culling mask.
  • … set them to render to Display 1 and Display 2
  • … place them on the same spot so they can see the quad.
  • … turn off HDR and MSAA, that’s something for the main camera. You could also turn of occlusion culling but I think it doesn’t matter in this case, since there is only one object in that layer.
  • Now you have to find the right distance of the quad to the cameras so it exactly fills up the view of those two cameras. The aspect ratio of the quad should be the same as the aspect ration of the displays. That sound like something that should be scripted. I think it’s important that you are really exact here, so one pixel from the main camera exactly represents a single pixel in the indirect cameras, it’s an exact copy of the image and you won’t lose quality. Of course, this won’t work when you have two different resolutions. But I think you have to deal with that since the only possible way to avoid that would be to completely render the scene twice with every single mesh renderer and not just a single quad.