A different way to Render?

Hi, I have 4 cameras in one scene and I want them to render all at once however when they render in game they overlap each other, I want them to render in different spots. I don’t know how to explain this. Here an example of how I want it(Attachment). Please help or give an idea.

2257057--150867--holho-3.png

You set the “Viewport Rect” on the camera so that it’s “from this X to this X” and “from this Y to this Y” as screen percentages, 0 to 1.

Is it possible to rotate it instead of rotating the camera.

Using a script, sure. Just calculate the “center point” as new Vector3((max X - min X) / 2f, (max Y - min Y) / 2f, 0f) then feed each “corner” into a function you make like one of these in this answer along with the center point and the amount you’d like to rotate by. You could also rotate the projectionMatrix on the camera directly using a Quaternion.

Far, far, far easier to just rotate the camera though, IMO.

I don’t seem to comprehend. Here’s what I have rendered(Attached)
I want the left image to rotate in 90 degree so the top of the trapezoid is pointing right.

2258402--150981--Screen Shot 2015-08-19 at 2.26.44 PM.jpg

I misunderstood. I don’t think you can do what you want- you’ll need to rotate the camera itself by setting the localRotation.z to 90 or something. As that requires about 2 seconds of effort and is easily reversible, I can’t imagine a reason to make things more complicated than that.

I would like to update this response and say that this IS in fact possible without changing the angle of the camera, two different ways that I can find.

One is direct manipulation of the Matrix4x4 for the camera’s projectionView, which I already mentioned and which is pointless because you can just rotate the camera. If the point of not rotating the camera is that you don’t want to manipulate the camera at all (which is the only reason I could think of) then manipulating the projection matrix is just a far far far more complicated method of achieving the same undesired result. It’s also horrendously complicated (after spending several hours staring at documentation and examples, I’m still completely lost).

The alternative method, using RenderTexture, has several methods. Worth noting that while RenderTexture was a Pro-only feature pre-Unity5, it’s now available to everyone (yay!). The two distinct methods are to use the UI system or to use an actual object (like a flat plane) in the scene.

Assuming “UI method”, you can create a new UI element (Raw Image) in a Screen Overlay that’s been set to the area of the screen you want the camera to render to. You can then set the RenderTexture to the texture member of the Raw Image component, which should be pretty much all you need (unless you want to write a script the automatically changes the height/width of the UI element to match the aspect ratio of the camera or height/width of the RenderTexture or something). You can then rotate the view on the screen by just rotating the UI element.

Thank you, I really thought this wasn’t so complicated, but thanks for your effort. I will try thanks again.

Are you trying to create a holographic game? :slight_smile: I’ve seen some sample animations in a video, seems cool.

I am but having a hard time using the camera.

1 Like

Can I see the examples.