Drawing 100,000 object in multiple frames

Suppose you have a very heavy scene you can’t draw in one step (it takes 4 seconds to draw completely). ZPR would be impossible, even simplifying what to draw in dynamic movements.

Would it be possible to draw a reasonable number of objects, take a snapshot of color and depth buffers and add more objects in subsequent frames at some interval of time? I mean blending previous frame snapshots (buffers) with current ones?

The final effect would be that if the user does not move you see the scene populating progressively at each timer tick, while if the user moves the camera you can interrupt and start over.

Thanks,

Alberto

That sounds like a bad idea. If the user constantly moves the camera, they will only ever see a partial frame while the camera is in motion.

It’s not clear what kind of application you’re trying to make. But I would work on optimizing my renderer somewhat if at all possible. Unless those objects are gigantic, the shaders are huge, or the hardware is sub-par, 100,000 objects per frame ought to be achievable with interactive framerates (even 10fps ought to be do-able).

However, if you do choose to move forward with this, then just render to an FBO instead of the screen. Whenever you want to interrupt rendering to draw what has been rendered thus far, simply blit the color buffer to framebuffer 0.

Alfonse,

Think big 1,000,000, 10,000,000 objects. I would like to continue to add objects if the user hesitates and interrupt immediately if the users start to ZPR again.

Do you know this technique? Where I can read or see more? Like articles, videos, etc.

Thank you.

Alberto

Then maybe you should have used those numbers instead of 100,000.

I told you what to do in my last paragraph.

Ok for using the FBO but I was more interested in the sequence of calls to draw only the additional objects on a static FBO representing the previous frame screen.

I would prefer not to start from scratch.

Thanks again,

Alberto

Think about what kind of scene you’re describing. With millions of objects, if the objects don’t overlap then each object is only going to be a pixel or two in size, on average. If they do overlap then you’ve got a scene setup and culling problem, and I absolutely guarantee that your visible portions of the scene do not contain as many objects as you think.

People always ask this kind of question. On the face of it, it can seem an attractive enough optimization - if there are portions of my scene that don’t change from frame to frame, how do I reuse them rather than redraw them? And the answer is always the same - don’t bother, it’s not an optimization, it’s simpler to just redraw everything, and anyway that’s actually the optimal approach for graphics hardware.

Your specific case of this question seems very theoretical and vague. You’re asking about arbitrarily huge numbers of very non-specific objects. What are the objects? What are you actually trying to do? This could range from something solvable by implementing a particle system (in which case millions is easily achievable) or could require more complex scene setup. There’s no one-size-fits-all approach.

Your specific case of this question seems very theoretical and vague. You’re asking about arbitrarily huge numbers of very non-specific objects. What are the objects? What are you actually trying to do? This could range from something solvable by implementing a particle system (in which case millions is easily achievable) or could require more complex scene setup. There’s no one-size-fits-all approach.

My question is about adding object to a complex scene in batches without the need to redraw everything at every frame. I don’t want to have limit in number of objects, after small size culling and frustum culling I need a reasonable FPS.

So please, if you know an article, tutorial that explains how to blend a second draw with an existing one (color and depth) please link it.

Assuming your rendering needs a depth and/or stencil buffer for correct rendering, then again, just do what Alfonse suggested to you up above:

That is, for each fully-rendered image of the scene…

  • Clear FBO
  • for i in 1…NumSubsets
    – Render Subset i to FBO
    – Blit from FBO to window
    – SwapBuffers
    – Rinse/repeat

It’s just the same sequence of calls you would make to render all of the objects all at once, except broken up into batches separated by blit and swap-buffer calls. This really isn’t that complicated.

Thank you all guys, it does only remain for us to try…