- Home /
Multiple Cameras Perform No Better On Better System
Hello. I am using Unity 3.5.1 for the backend of a robotics simulation. As such, I have multiple Unity cameras on a vehicle pointing in different directions for situational awareness. The problem is that all of these cameras need to be enabled, which means that they're constantly rendering the scene. This works okay with three cameras (the main camera plus two extra), but as soon as I start adding more the frame rates drop to unacceptable levels.
I assumed this was a graphics device limitation, so I inserted a second video card and tied them together via SLI. The frame rates did not improve. Am I incorrect? What is the limiting factor in having multiple Unity cameras if not the graphics card?
Thank you for your help.
UPDATE:
To duplicate, run the original Bootcamp demo included in Unity (3.5.1). Add four more cameras to the soldier_location object. Remove the audio listeners from all four, leave the other settings as default. Don't even worry about positioning the cameras. Now, play the game. Notice the drop in frame rates.
To answer the question of what the cameras are used for, they are simulating real-world stereo camera pairs. This means that each camera renders all parts of the 3D scene. For this example, the cameras are completely unused other than simply being enabled. Could the CPU still be the bottleneck?
What are your cameras doing inside Untity? Are they rendering a 3D scene? Displaying the camera picture via render-to-texture? Performance characteristics for 3D engines are very complex, and you could be bottlenecked by either the CPU or GPU depending on what you're doing.
You're right, frame rates dropped significantly. Not sure what the limiting factor is though....
Answer by Drakestar · May 17, 2012 at 06:22 PM
To answer the question of what the cameras are used for, they are simulating real-world stereo camera pairs. This means that each camera renders all parts of the 3D scene. For this example, the cameras are completely unused other than simply being enabled. Could the CPU still be the bottleneck?
In that setup, the CPU will indeed be the bottleneck and no GPU in the world will by you better performance. Even though you're not rendering through those cameras, they still need to perform a lot of heavy lifting behind the scene: gathering all objects, rejecting them based othe camera's view frustum etc. Potentially (although doubtful), they even build a framebuffer. I don't have access to Unity to test anything right now - but generally speaking, whenever you have more than one active cameras in a scene, the CPU will have to do more work.
That makes total sense-- I didn't even think about frustum culling. Technically, couldn't the actual frustum culling be multithreaded by Unity even if sending the data to the video card was mutexed? Do you think that would improve things?
Answer by cregox · May 17, 2012 at 05:25 PM
I just tested 5 cameras on a mac mini (no video card) with 2gb RAM. I've added a single particle and tried them both with Clear Flags off and with view port rect. No performance issues at all.
On my PC (8 RAM, quad core, GeForce GT 440, 6.8 windows index rating for graphics) I did a second test using AngryBots and 11 cameras. I've attached 10 cameras into the Main one and removed audio source. No performance hit what so ever. Same test on the same mac above: same results. Then I separated them into 11 different rect view ports. You guess it.
What I did noticed is the FPS went down from 250 to 30, but it was 11 cameras. And it's linear, unlike what you say. If I just hit CTRL/CMD+D to duplicate the extra cameras while on game play, I can see the FPS going down by about 20 fps for each extra camera, which makes sense.
As Drake commented, there are too many things that could be wrong in your case, but hardware resource must not be it.
If all those camera actually process, render and display the scene, hardware resources will be a limiting factor. But it could be anything - scene setup, geometry throughput, fillrate... Need more information.
Thank you for running that test! If you would be so kind, could you please run the test described in my updated question with the Bootcamp demo? Does it still run perfectly?
@Beacon11 as soon as I download it. Is it ok testing it on AngryBots?
@Beacon11 couldn't find BootCamp, I hope AngryBots is good enough.
That's very interesting... unfortunately I can't test AngryBots since it requires an external server, but I still find it interesting that it works for you with so many cameras. I didn't mean to imply that the change was nonlinear-- in fact, I would say that it is.
Your answer
Follow this Question
Related Questions
Light gun simulation 2 Answers
RigidBody Physics Flight Simulator Script Help 1 Answer
Basic questions for moon landing game 1 Answer
Can I run a duplicate physical world at high speed? 0 Answers