Sprite manager and draw calls

Hello there,

I trying to reduce the draw calls in my project and in my in investigation I noticed that a sprite manager is taking 2 draw calls even if we have no sprite in its sprite list.

So just adding this line will cost you 2 draw calls :

var spriteManager = new BABYLON.SpriteManager("spm", "fakeurl", 1, 10, scene);

Is it a bug or there is a reason for this behavior ?

If no reason is possible to fix it in the next Babylon version ?

Cheers.

Definitely a bug!!! I’ll make sure to fix it for next nightly

Thanks for reporting

Ok great, I was thinking to use planes instead with billboard mode set to true but if it’s a bug I’ll wait then :slight_smile:
Thank you!

Hello,
Me again :slight_smile:

Another things, when I set the property “isVisible” to false of all SpriteManager’ sprites I still have a draw call.
Could we consider this behavior as a bug as well or should we consider it’s the dev job to release the sprite manager or change it’s layerMask to avoid this useless draw call?

Can you reproduce it in the playground?

Yes, here is the PG

https://www.babylonjs-playground.com/index.html#Y0I3LV

As you can see I have 3 sprites in my sprite manager, all those sprites have their property “isVisible” switch to false but we still have 3 draw calls.

I will fix that for next commit!

But after all it’s maybe better this way for performance reason.
If Babylon core has to check all sprites status when one sprite setting is changed it’s not so good and it’s better to check yourself in this case I guess.

I’m looking at it right now to understand why there is still 3 draw calls

Ok I added a easy check.It will be good with next commit

Great!
Thank you Deltakosh