Just a question regarding performance hit when adding extra camera’s.
I want to have 4 cameras all showing the same scene from different angles, and I want another set of 4 cameras “on top” of these set to “Depth Only” so that I can display a few 3D objects on the scene on top of everything else. (Total of 8 cameras showing at once, maximum).
This is the worst case scenario, in many cases only one camera will be showing, but I need to plan around the worst case.
It’s a relatively small scene, up to a few hundred primitive cubes with diffuse materials, so nothing major, no high res textures, and if anything a single more complex mesh.
What do you think of performance issues?
Also is there any limit to the number of camera’s for any particular reason (rendering etc)?
The performance hit is that each camera needs to render the scene so with 4 cameras you are potentially rendering 4 times the amount of geometry. So a few hundred cubes could become 1200+ draw calls which will start to slow down some computers. AFAIK, there is no hard limit to the number of cameras you can use.
Thanks, does simple geometry without any complex shaders or shadows have much of a performance hit?
The 100 cubes would only be rendered on the depth cameras (on their own layer), so only 4 cameras maximum would draw those, which is ~400 simple cubes using diffuse shaders with a solid color and no texture, shadows (receiving and casting) disabled for those cubes.
It doesn’t sound like performance would be much of a problem even on lower end systems, but I could be missing something?
I understand that, I just thought people on the forums with experience could give advice. After all it would be a shame to do something that way only to figure out performance is going to be an issue down the track.
You’re trailblazing at this point, bro - just make your tests and report back your findings so that perhaps you’ll help others wanting to do similar in the future…
The biggest performance killer is water (pro/water3) in combination with realtime shadows. Until you dont have some water in scenes, multiple cameras does not make big problem.
But it depends, if each camera render all layers. If you have each camera for different layer(s), there is almost no performace loss. But it really depends on setup, especially water can be tricky.
Thanks Demostenes, makes sense. I guess there is probably a slight overhead having 2 cameras even if the total amount being rendered is the same, it’s probably negligible though.
There will be no water or real time shadwos so should be good.
water unity is so bad. so bad. dont use it.
multiple camera (render all layers) can affect in rendering time and fps very much.
Use one camera at a time.
I am using 1 camera for 1 layer and have a bad feeling about this. Tests run well, but may be there is soma technical hidden stuff, i should be aware about, using 1 camera = 1 layer rendering?
Hmm, Although all this, Me I’d been trying to implement inside my game a whole bunch of approximately 60 cameras so to recreate the bullet time effect inside my game but on the most crucial moment it all got hanged up because I’ve been trying to render my scene through 60 different cameras along with some slow-mo script that I’ve found of And I don’t get the reason why, huh? They are nothing more than just cameras with no activation on them. Why, why, why? They are only points in space that are not activated at all!
manavdis, they are activated one after the other? May be some preconfiguration thing? A disabled camera should not be a problem.
In my case, I think the easiest way to manage differect aspect ratios is to take care of the viewport rect when the aspect goes above 1.33333f. But the viewport gets buggy without a camera, then the way I found is to have two cameras, one full viewport and the other a clipped rect. In the statistics, it say I have +1 SetPass calls, I hope it isn’t a problem =/
I often use multiple cameras each rendering different layers of the scene. Of course you are adding some more Camera components, but as long as each of them is rendering distinct layers, you should not get a big performance hit. E.g. having a camera for the 3D geometry, one for background UI, one for foreground UI, one for a minimap render texture should also work quite fast on mobile devices.
In my opinion, a good practice is to enable/disable cameras based on their usage. Disable a camera if its output is not visible in a view.