[MASSIVE MODELS] Is there a way to modify the rendering/drawing loop?

Hello!

I´ve been thinking about how to work with massive models, and I´ve got an idea.
(Kinda stolen but whatever…)

Currently the drawing call renders ALL of the objects in a single frame.
For large models there is a lot to draw, so there is more time between the calls, leaving us with bad FPS.

So the more complex the model is, more and more time (processing power) is needed to render a single frame.

So my solution would be calling the render for each object (or a batch of objects), not all.

The problem with this solution is that the objects would popup on the screen, but that is not a problem for my project.

So instead of drawing everything on each frame, I would draw everything I could till my time limit, then when this limit is reached the drawing frame method is called.
This will make the FPS stable, since the draw call time would be “fixed”.

We could work on the model normally, with the drawback of objects popping up every time the camera changes.

What do you guys think about this?
Is it viable to do for glTF format?
Am I crazy?

Please share your opinion about this subject.

Hi, yes I also do things like that sometimes, it works well. In my case I make a variable loopCounter that starts at 0, and at each frame I do
loopCounter = (loopCounter + 1) % 6 ;

So in my render/animation loop I can use loopCounter value to do things only half the frames, or less, to balance the work. It’s especially useful to animate objects in the background, or slow objects.
You have to manage several clock objects though. It looks like that :

var delta;
var loopCounter = 0;

function loop() {

   requestAnimationFrame( loop );
   loopCounter = (loopCounter + 1) % 6

   // everything here is called every frame
   delta = clock1.getDelta();
   mixer1.update( delta );

   if ( loopCounter % 2 == 0 ) {
      // everything here is called 30 times per second
      delta = clock2.getDelta();
      mixer2.update( delta );
   };

   if (  loopCounter == 0 ) {
      // everything here is called 10 times per second
      delta = clock3.getDelta();
      mixer3.update( delta );
   };

};

I suppose you might do something similar with the renderer(s?) instead of animation mixers.

3 Likes