当前位置: 动力学知识库 > 问答 > 编程问答 >

unity3d - Offsetting the rendered result of a camera in Unity

问题描述:

I am trying to make everything that is rendered by my perspective "Camera A" appear 100 points higher. This is due to the fact that my App has an interface with an open space on the upper part.

My app uses face detection to simulate the face movement into an in game avatar. To do this I compute the "Model-View-Matrix" to set it into the camera's "worldToCameraMatrix".

So far this works well, but everything is rendered with the center as the origin, now i want to move this center origin a certain distance "up" so that it matches my interface.

Is there a way to tell Unity to offset the rendered camera result?

An alternative I thought about is to render into a texture, then I can just move the texture itself, but I thought there must be an easier way.


By the way, my main camera is orthographic, and i use this one to render the camera texture. In this case simply moving the rendering game object quad up does the trick.


I found a property called "pixelRect", the description says:

Where on the screen is the camera rendered in pixel coordinates.

However moving the center up seems to scale down my objects.

网友答案:

You can set the viewport rect/orthosize so that its offset or you can render to a render texture and render that as a overlay with a offset or diffirence in scale.

Cheers

分享给朋友:
您可能感兴趣的文章:
随机阅读: