- Home /
How do I render to texture only a part of the cameras view?
Hi! I want to render only a part of the cameras view.
I set camera's height to half so camera only captures half of screen.
camera.rect = new Rect(0, 0, 1, 0.5f); //. set camera's height to half.
I set RenderTexture's size same with cameras render size in pixel. so it can contains whole contents of camera (just 1 : 1 pixel).
_renderTexture = new RenderTexture(camera.pixelwidth, camera.pixelheight, 0, RenderTextureFormat.ARGB32);
I assign RenderTexture to camera.
camera.targetTexture = _renderTexture;
Draws _renderTexture on screen.
GUI.DrawTexture(rt, _renderTexuture);
I'd like to render camera's real capture view(half of screen) to texture(just half screen)
But renderTexture contains whole screen(Screen.width, Screen.height).
What's wrong with me?
How can I render only a camera's view(half of screen) to texture?
Help me.
Thank you,
Best Regards,
Adam.
Your answer
Follow this Question
Related Questions
Unity camera troubles 1 Answer
Camera panning on pre-rendered backgrounds 2 Answers
Camera frustums + custom field of view 2 Answers
How to retrive camera pixel data? 0 Answers
Rendering the same Render Texture differently to separate cameras 0 Answers