Jump to content

  • Log In with Google      Sign In   
  • Create Account

Multiple cameras rendering in OpenGL


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 sienaiwun   Members   -  Reputation: 128

Like
0Likes
Like

Posted 13 October 2012 - 08:22 AM

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?

Sponsor:

#2 m41q   Members   -  Reputation: 151

Like
0Likes
Like

Posted 13 October 2012 - 10:48 AM

I don´t know, but...
why would one want to have that many cameras?
Do I understand it right that you want to have 300-700 different point of views?
If so, it is pretty obvious the computer has very much to do...

#3 samoth   Crossbones+   -  Reputation: 4765

Like
0Likes
Like

Posted 13 October 2012 - 11:25 AM

You could use the geometry shader to duplicate your geometry, transform each duplicate with a different MVP-matrix (skip that in the vertex shader), and assign each duplicate to a different gl_ViewportIndex.

That will render N different "cameras" at one time.

Of course, things that are normally kind of "simple" such as occlusion culling your view frustum are totall impossible then, because you cannot know a priori what cameras 3, 4, or 17 will see (well... you can ... but it's not that trivial any more, and no big efficiency gain anyway, since you must render a lot of geometry that is culled from either viewport).

It's probably just as fast (and more straightforward) to just use many different FBOs and render once into each one in a for loop as you're doing already.

Note that when you have 300+ cameras in one scene, a very allowable optimization is to only render each camera every 5th or 10th or so frame. Nobody will notice anyway. That way you only have to render maybe 30 cameras per frame.

Edited by samoth, 13 October 2012 - 11:29 AM.


#4 MarkS   Prime Members   -  Reputation: 882

Like
0Likes
Like

Posted 13 October 2012 - 01:05 PM

This is an odd question. Unless you can get all (or even a portion) of the cameras to render in parallel, you are going to have to render the scene in each camera sequentially. In that case, why not just use one camera and move it from position to position?

#5 sienaiwun   Members   -  Reputation: 128

Like
0Likes
Like

Posted 14 October 2012 - 01:42 AM

I appreciate your answers very much.

You could use the geometry shader to duplicate your geometry, transform each duplicate with a different MVP-matrix (skip that in the vertex shader), and assign each duplicate to a different gl_ViewportIndex.

I considered it to be as same as I have done in time performance because vertex duplication takes almost the same time. Does it so ?

Of course, things that are normally kind of "simple" such as occlusion culling your view frustum are totall impossible then, because you cannot know a priori what cameras 3, 4, or 17 will see (well... you can ... but it's not that trivial any more, and no big efficiency gain anyway, since you must render a lot of geometry that is culled from either viewport).

It's probably just as fast (and more straightforward) to just use many different FBOs and render once into each one in a for loop as you're doing already.

I do not get it. Can you explain it further?

Note that when you have 300+ cameras in one scene, a very allowable optimization is to only render each camera every 5th or 10th or so frame. Nobody will notice anyway. That way you only have to render maybe 30 cameras per frame.

Thanks, I have considered it seriously .

#6 sienaiwun   Members   -  Reputation: 128

Like
0Likes
Like

Posted 14 October 2012 - 01:54 AM

This is an odd question. Unless you can get all (or even a portion) of the cameras to render in parallel, you are going to have to render the scene in each camera sequentially. In that case, why not just use one camera and move it from position to position?

My "render in parallel" way is that: group the cameras. In each camera group, the viewing frustums of cameras do not intersect to guarantee proper vertex MVP projections in vertex shader.
It has drawbacks:
1. Many geometry need to be divided into many pieces manually . ex:the ceiling plane need to subdivide if a camera look at the center of the ceiling plane .
2. The grouping is not good. In average, 2 cameras in a group

#7 sienaiwun   Members   -  Reputation: 128

Like
0Likes
Like

Posted 14 October 2012 - 01:56 AM

Do I understand it right that you want to have 300-700 different point of views?
If so, it is pretty obvious the computer has very much to do...

I use it to render different textures. all cameras are in different place, looking at different views.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS