How to correctly partition a sprite sheet to a single particle?

Hello all,

I’m working with this playground:

I’ve imported a sprite sheet from here:Babylon.js/Fire_SpriteSheet2_8x8.png at master · BabylonJS/Babylon.js · GitHub

The import worked well, but the partition of the sprite, which is 8X8 doesn’t work in my scene.
This is what I get:

instead of each “flame” be a single particle.
In this playground tutorial:
The sprite partition works correctly.
But I don’t understand why the tutorial uses 64 for sprite height and width, it seems to be much less. Can you explain please why use this number?

I’ve copied this logic and simply adjusted the numbers regarding the sprite sheet, but it is not working.

Why does the partition is wrong in this case?

particleSystem.startSpriteCellID = 0;
particleSystem.endSpriteCellID = 63;
particleSystem.spriteCellHeight = 128;
particleSystem.spriteCellWidth = 128;
particleSystem.spriteCellLoop = true;

and it’s working correctly.
But I still would like to understand the logic behind this partition. Why the correct number on 8X8 sprite is 128?



Because this is the size in pixels of each sprite :slight_smile:

1 Like