Camera View Port Rect Size

I have a wide screen format that I want to divide in half, with one camera on the left and one on the right. The left camera will be set to Skybox and show the scene, and the right camera will be set to Depth Only and show some interface elements.

This is the part that’s tricky to explain (see the attached image). I want the scene camera to fill the whole screen, but be shifted to the left. In other words, I want an object directly in front of that camera to be centered in the left half of the screen. The right half of the screen would be where the interface elements will appear.

I thought I could offset each camera by 0.5 (scene camera = -0.5, interface camera = 0.5), then set the width of the scene camera to 1.5. But it looks like the camera width cannot exceed 1.0.

Is there any way to achieve what I want? What I don’t want is to just shift the scene to the left relative to the camera. With a perspective camera, it looks distorted if it is too far toward the edge and not centered in front of the camera.

Try this: http://www.unifycommunity.com/wiki/index.php?title=OffsetVanishingPoint

–Eric

Thanks. Is there any way to do that in the Inspector, since it will never change? I can’t find any reference to the projectionMatrix except in the script guide.

Now that I look at it, it also says the camera will no longer updated based on FOV. That is something I have change to zoom the view. So it looks like very change in the FOV, the projectionMatrix will need to be reset then set again.

That works great! Not a problem with doing it in a script vs. the Inspector, as I have to do it every time the FOV changes.

But the problem now is changing the FOV to zoom in and out. The FOV no longer lines up with the vanishing point. So when I zoom in by shrinking the FOV, it zooms to the center of the screen. But the objects I want to zoom in to are now in the left half of the screen. I think I’m missing something because the camera preview window (a great new feature in 3.0) shows it zooming in correctly, to the center of the object directly in front of the camera. Any suggestions?

No, but you would just call the function once in Start, although…

In this case you would call ResetProjectionMatrix, set the FOV, then call SetVanishingPoint.

–Eric