0 Favourites

automatic spritesheeting weirdness

  • I noticed that automatic spritesheeting on export something behaves very strangely.

    For example: I have two sprites

    Sprite1 have 3 animation frames with 57x36 size and after export it creates 3 separate files with same size.

    but for Sprite2 which have two 258x17 sized frames it export one 512x512 spritesheet ?! Leaving ~80% of this image empty.

    and I have a lot of similar sprite sheets with over half space wasted.

    Not sure why it is doing this way, but logically It could easily fit those three 57x36 frames on a single 128x128 texture, and make two separate ones for 258x17.

    But for some reason "it" choose differently, making probably 70% of my all images in that strange almost half empty sprite sheets :/

  • yeah i noticed the same problem, often it is like all the small images together could just go in the blank space of the bigger ones :/

  • Right now there are (for all I know) no "real" sprite texture atlases, the sheets get only created per sprite.

    So frames from 2 different sprites currently won't end up on the same sheet, even if there was space left.

  • Yes I'm aware of that. I'm not talking about different sprites but Sprites with multiple animations frame.

    It looks like this.

    Sprite1 with 3 animations frames - each 57x36

    [attachment=1:1zy9qpkb][/attachment:1zy9qpkb]

    As you can see these three animation frames, which are exported as three separate images could easily fit on one 128x128 image

    Sprite2 with 2 animations frames - each 266x52

    [attachment=0:1zy9qpkb][/attachment:1zy9qpkb]

    But for this sprite it puts all frames into one 512x512 image. Leaves almost entire image empty! And about 90% of my images looks like that after export :/

  • 266x52, if you will see, fit only in a 512x512 square shaped spritesheet, yes, they are square shaped, which I found weird but there may be a reason for that.

    Unless you meant that there were more than 2 frames and they did not get fitted into it.

  • Yes, I understand that.

    But if 266x52 fit only in a 512x512 then 57x36 should fit in a 64x64, right? and they also should fit to 128x128.

    What I meant was, why after export some sprites are put into a sheets and others are not.

    If those three 57x36 frames and two 266x52 frames after export end up respectively on three 64x64 and two 512x512 then I would now what is going on and try to improve that. But currently I have no idea how C2 is deciding which sprites export as a sheets and which ones as a single files.

    I made some more test, and I still don't know how it works

    3 sprites, every one have 3 frames

    test 1

    sprite1 - 3 frames 48x48

    sprite2 - 3 frames 32x32

    sprite3 - 3 frames 64x64

    • every frame is exported separately - 9 images after export

    test 2

    sprite1 - 3 frames 42x66

    sprite2 - 3 frames 76x44

    sprite3 - 3 frames 57x23

    • every frame is exported separately - 9 images after export

    test 3

    sprite1 - 3 frames 120x99

    sprite2 - 3 frames 258x258

    sprite3 - 3 frames 160x160

    • every frame is exported separately - 9 images after export

    test 4

    sprite1 - 3 frames 42x66

    sprite2 - 2 frames 32x32, one frame 64x64

    sprite3 - 3 frames 57x23

    • Sprite1 and Sprite 3 - every frame is exported separately - 6 images after export
    • Sprite2 - this one exports to one 128x128 file and one 64x64 - 2 images after export

    It looks from these very simple tests that only frames which differ in size are sprite sheeted. But in tests only, In my game I have lots of frames with different size and they are still randomly exported as single images or sprite sheets!

  • Could it be that sometimes separate sprites actually take less memory than the larger single image sprite sheet?

    I also wonder if instead of 3 frames you used 4 if more images would be combined as a sprite sheet instead of seperate.

  • shinkan That is because Construct uses power of 2 for spritesheeting. So, in your case, 3 64x64 images are smaller than one 128x128 image. Also, two 258x17 can`t be on a sheet that is lower size than 512, because 512/2 = 256, your image is 2 pixels too wide. And considering that Construct uses 1 pixel each side for sheeting, the max size for a 512x512 sheet would be 254.

    Hope I could help you, and sorry for my "engrish", I am Brazilian.

  • shinkan That is because Construct uses power of 2 for spritesheeting. So, in your case, 3 64x64 images are smaller than one 128x128 image. Also, two 258x17 can`t be on a sheet that is lower size than 512, because 512/2 = 256, your image is 2 pixels too wide. And considering that Construct uses 1 pixel each side for sheeting, the max size for a 512x512 sheet would be 254.

    Hope I could help you, and sorry for my "engrish", I am Brazilian.

    I'm all aware how C2 uses power of 2 texture, you don't need to explain that to me.

    I'm not complaining, C2 does a great job with sprite sheets, but occasionally it's hard to predict what results you will get.

    And it still does not explain why textures make with proper size are sometimes sprite sheeted and sometimes not.

    In my current project I have a sprite with 14 frames, each one is 1022x254 - made them like that so they can be all placed in nice sprite sheets after export. And again sometimes it will make 1 sprite sheet 2048x2048 (which fits all frames all together), sometimes it will make 2 sheets 1024x1024, and rarely it makes 14 separate images 1022x254. and even more very rarely i got few 1024x1024 sheets with only two images inside.

    So yeah. I only try to understand how C2 decides what and when will be sprite sheeted.

  • Spritesheeting is subject to various options like the project downscaling quality setting, the image format of each frame, and a few other things. I could not say why this is happening unless you provide a .capx demonstrating it.

  • Spritesheeting is subject to various options like the project downscaling quality setting, the image format of each frame, and a few other things. I could not say why this is happening unless you provide a .capx demonstrating it.

    I would happy to provide you capx file, but unfortunately this behavior is so random so even if I make a demo file there is no guarantee that this will happen at all :/

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • You mean every time you press export something different happens? That would suggest a bug.

  • I have the same pb here.

    Sometimes C2 creates strange spritesheets.

    I have a sprite with 3 images (55x33, 63x34 and 250x72), and C2 creates a spritesheet of 1024x1024.

    It was ok until I changed one of my image in my spritesheet.

    I have that kind of problems with different sprites (for example, C2 creates 2 spritesheets of 512, even if my 4 images of the sprite are smaller than 256x256, with 3 on a 512x512, and the last one on the other).

    I think it's a bug, cause last time I worked on C2 (months ago), I never had that kind of problems.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)