Multi-Cameras rendering

Hi.
I am new here.
Is there a solution for multiple cameras (300~700 in number) rendering in a scene. I solve it in a easy way by for-loop and it’s time-consuming. Any better idea?

The primary issue is that you need a different model, view, projection transformation for each camera, which means that you effectively need to duplicate primitives (triangles). You can use a Geometry Shader to achieve that: apply different model,view, projection transformations to a input triangle to get the different outputs. It’s probably not realistic to handle the 300-700 cameras in one go (geometry shaders have limits on how much data they can output), but you could use it to render maybe 5-10 cameras in one pass instead of needing one pass per camera.
However, with those numbers of cameras it’s going to be difficult to be fast no matter what (at least that would be my guess - hoping to be wrong :)).

I guess instancing would be faster, just dump all the matrices in a UBO array and index them via gl_InstanceID in the Vertex Shader.