Different target resolutions per camera

Hi All

Is it possible in Unity to have two cameras in the scene, each with different resolutions?

We have built a detailed GUI system at a 2560 x 1600 resolution, but I would like to be able to independently set the resolution of the scene camera (to say, 1280 x 800) whilst still keeping the GUI camera at 2560 x 1600.

Is this possible?

Thanks

you should use RenderTextures for this. And no - this is not possible otherwise (but not due to Unity)

Thanks Alexey. It was an idea mainly aimed at increasing performance on mobile - I assume that using RenderTexture wouldn’t see any performance gain (probably the opposite)?

A lot depends on whether your game is CPU limited or GPU limited. If you are doing a shed load of calculations in script, and not a lot of rendering, then your game is CPU limited, and it really doesn’t matter what resolution you render to. If, on the other hand, you have lots of complex shaders, have large amounts of overdraw, then you’re probably going to be GPU bound, in which case, asking the GPU to do less work by giving it fewer pixels to render to can make a big difference.

1 Like

Hi Graham, I think i’m confusing the issue.

With a rendertexture, doesn’t it have to still render the original, high res image first, and then it can apply some sort of transformation on it?

So if I was looking at optimising performance, using a rendertexture would be worse because I’m still rendering the original high res image and then applying an additional process on top of that (say, to render it at half resolution).

Am I totally wrong about this assumption?

Thanks for your help!

With render textures you can render to whatever resolution you want. So, if you happen to find that 256x256 is a sweet resolution, you can render that, and then stretch that to full-screen.

hi, sorry to revive and old post, but I’m wondering why you can’t set the resolution in a per camera basis, and also if there is no other way to do this than assigning a renderTexture to each camera with different resolutions, how you appy it back to the screen buffer so the end result is basically put into the screen?

in my case I have two cameras, MainCamera and ExtraCamera, the extra camera is child of the main one, and has the exact same position and everything, the idea is this:

Main cam renders with near plane 0 and far plane 3, and extra cam renders with near plane 3 and far 1000.

since in my game I need to focus mostly on what happens near to me, I want the main cam to render at full resolution (example 1920x1080) while the extra cam renders at half res or quarter, what is on the far away. I put main camera to render on top of extra cam (depth of main cam is less than depth of extra cam).

If I could only set the resolution of the extra cam independently, I would be able to achieve a performance boost with this.

I found a guy who figured out how to customize the render scale with a simple script, but it seems to be changing the scale for all cameras although it theoretically should be affecting only the camera assigned with the script.

check this out: