I’m trying to find the best method to render the view taken by a camera to multiple displays via an image-effect material, where the material has different parameters set for each display. I’ve tried to use the following code to blit a texture to a specific display, but it doesn’t work;
public void RenderTextureToDisplay(
Display display,
Texture texture,
Material material)
{
Graphics.SetRenderTarget(display.colorBuffer, display.depthBuffer);
Rect screenRect = new Rect(0.0f, 0.0f, display.renderingWidth, display.renderingHeight);
Graphics.DrawTexture(screenRect, texture, material);
}
The only solution I’ve got to work is to use a Canvas containing a RawImage, where the RawImage is assigned a RenderTexture. The Canvas has its displayTarget set to the display that I want to render to, and the RenderTexture has its dimensions set to the display renderingWidth and renderingHeight. I then use Graphics.Blit to draw my texture/material to the RenderTexture. Although this does work, it seems to be possibly causing a performance issue (I’m guessing because I’m using so many RenderTextures).