babbleon

rendering as few frames as necessary

Recommended Posts

Hello all,

I am rendering out some images which get posted back to my server and I'm having issues with the function firing more frequently than it should.

I have two loops; loop1 & loop2... which should call the createThumbnail() function 9 times in total and then stop rendering. However, if you have a look at the console you will see that it gets called 36 times in total (1+2+3+4+5+6+7+8).

Here's a PG: https://playground.babylonjs.com/#I4SUSQ

I think I'm doing something silly & obvious, but can't see it... any help would be very welcome.

Thank you,

 

Share this post


Link to post
Share on other sites

?

That's just the index of the loops.... not the number of times they are called.  This is doing what you're expecting.  Well it's just calling it 8 times but that's probably due to the AfterEvent not firing the way you have the code.

 

What are you trying to achieve?  It seems a little over-complicated.

 

Share this post


Link to post
Share on other sites

Here's a tweaked PG.. the numbers in the blue circles on the previous attachment are duplicated lines on the console.

https://playground.babylonjs.com/#I4SUSQ#1 ... this shows what I thought, that for example 'loop1: 3 loop2 3' is called eight times.

I am ultimately trying to achieve a series of images to be saved to my server; loop1 might be an array of camera locations and loop2 might be an array of material colours.

Edited by babbleon
clarity

Share this post


Link to post
Share on other sites

This is due to the fact you are registering more and more tasks on the observable on each loop and they are running async.

so on 1 1 you put a callback in the observable runninng next frame 

on 1 2 you add a new one so 2 captures ill happen next frame and so on...

Why not using smthg more direct like https://playground.babylonjs.com/#I4SUSQ#2 ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.