VR

Hello Im building a game with VR.
I want to render one canvas in two different cameras.I have try get the postrender method in the main camera,change the world camera in canvas and then render the canvas in the second camera,but it cost so much time for unity.has Some one a solution for this problem?.I have another solution with more cameras,but is too slow for good fps in mobiles and i want to improve speed in my game.

You can setup multiple cameras for left/right eyes separately. Then use culling mask to control which layers are rendered per eye. It sounds like you might’ve tried this and the performance wasn’t good enough.

What do you need the PostRender function for? Is the canvas the same in both eyes, but other things are different per eye?

I have two cameras,but the canvas is the same for both cameras.By example,the lives counter is visible in the same position in two cameras.Then i have one camera active(left eye)and in the post render or prerender function ,i get all canvas and change the world camera(to right eye)and make a render for the right camera.but this take so much time for unity,get 30 ms for render a frame!its crazy!

My another solution are four cameras,one for left eye,one for right eye,one for ui(canvas),this three with render texture and another camera for render all(right,left and ui) with quads.The ui is drawn at right and left side drawing the ui render texture in two diferents quads,one in each side.this is a good solution if you want to apply post proccess functions but for this proyect i am trying to found a good solution to improve performance.then i want use only two cameras,not four!this last solution works fine but i need more speed on android platform.

The two camera solution

not drawing canvas in second camera

This is the code in first image

private void Callbacks_OnPostRenderEvt(Camera camera, CameraCallbacks callback)
{
SetCameraToCanvases(ExtraCamera); //Commented in second image
ExtraCamera.Render();
SetCameraToCanvases(MainCamera); //Commented in second image

}

void SetCameraToCanvases(Camera cam)
{
for (int i = 0; i < canvas.Count; ++i)
{
canvas*.worldCamera = cam;*
}
}
and generate a delay of 30 ms,why???