Anyway guys, thanks a lot for you help!. Really appreciate it. After weekend i will start working on some PoC but seems like i can adapt babylon to my needs.
The loop above only animates on ODD frames NOT divisible by 3. Eg. 7… etc. Output dampened.
You can also use that to easily animate many things simultaneously. Routing Frames.
TexturePacker looks interesting and I am going to have a go at adding a method of using it in sprite creation. To keep existing methods and effects on these sprites it will probably look something like this
(.ext means .jpg, .png etc)
var spm = new BABYLON.SpritePackedManager("name", url); // url will point to packed image as filename.ext and JSON will be filename.json;
var mySprite = new BABYLON.Sprite("name", spm);
mySprite.fileName = "individual sprite filename"; // eg spriteName.ext
//also have
mySprite.cellIndex = number; //relative to the place sprite added to packer, eg second sprite added will be 1;
Cannot guarantee it will be done or how long it will take so you still need to rely on your adaptation of Babylon. I will keep you informed.
Regarding point 3, it sounds like you are asking about spritesheet support at an actual mesh level (3d mesh), in which case, unless I’m missing something, Babylon still does not support yet with instanced meshes. I.e. Spritesheet support for instanced meshes take 2 – Unless I am misunderstanding, or unless you are looking for 2d only (in which case sprite manager should work fine).
I’d still kill for instanced mesh sprite support built into the framework @Deltakosh
I fail to see how this can be used to cap FPS, it will just halve the rendering cost no? How does this function block rendering? It doesn’t appear to, as an empty function block does the same thing as your false condition, and doesn’t appear to make a change in the scene.
I still run at max FPS when using this, with no change.
It is as @sebavan says. Your browser runs things, based on your hardware, once every time your display refreshes when done through RequestAnimationFrame. That will be higher for XR headsets, etc.
@douglasg14b what you see for FPS might not be accurate, especially if you are looking at the browser’s profiler. It would be being fooled, as it had no real idea that on half the times it called your render loop nothing actually happened.
What I mean is that that function doesn’t appear to block rendering, paste this and run it in a playground. An empty function (Or no call to engine.runRenderLoop()) still renders the scene as normal, how does explicitly asking your scene to render again, inside a function that doesn’t appear to block rendering if that call is not made, “skip” frames?
I propose that this is actually asking the scene to render extra times.
A quick playground test seems to corroborate that
Toggling commenting the following out:
let odd = true;
engine.runRenderLoop(() => { if (odd) scene.render(); odd = !odd; });