Problem with spritesheets, please help

Discussion and feedback on Construct 2

Post » Sun Jan 11, 2015 4:49 pm

Hi I am not sure, where this post belongs...

I have read everything about this Topic (https://www.scirra.com/blog/87/under-th ... onstruct-2 and https://www.scirra.com/blog/66/image-co ... onstruct-2), yet there is something unexplained to me.

Why is it, that I have Sprites like 32x32 or 64x64, but construct 2 does not glue them together like that, rather adding 1 px extra around the picture, causing the sprite beeing to big for 2n. Only, if I have Sprites like 30x30 or 62x62 it puts spritesheets toghether in the intended size. (See attachment.)

So basicly, construct seems to add a "bleed" of 1 px around the sprites. Why is that? Or how to deal with it properly, since my sprites ARE optimized.
Is this a bug? Or do I misunderstand something?
You do not have the required permissions to view the files attached to this post.
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Sun Jan 11, 2015 5:40 pm

C2 adds 1 px all around to prevent display rounding issues. it is normal and documented IIRC.

due to that, it is better to have sizes with pixels in (n^2)-2 form 30;62;126; etc)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sun Jan 11, 2015 6:43 pm

Without the 1px gap, resources batched together into sprite sheets would "bleed" when displayed on screen due to linear (or better) filtering on texture reads. We don't want sprites next to each other to mutually influence their colours around the borders.
Image
B
23
S
9
Posts: 237
Reputation: 2,207

Post » Sun Jan 11, 2015 8:58 pm

I understand, it is just strange, I never saw anything of that mentioned in all those documentations relating (optimal) sprite sizes. I understood everywhere it would be best to use power-of-two-sized images. Now I have to resize a lot :o

Thanks for your feedback guys!
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Mon Jan 12, 2015 8:12 am

MultipleChoice wrote:I understood everywhere it would be best to use power-of-two-sized images


Indeed, but the power-of-two thing (non-necessarily square, btw) applies to whole textures, i.e. as loaded in the video memory ; due to data alignment and hardware architectures, these textures are faster to process.

When putting smaller textures/sprites into larger atlases (or spritesheets), the source size doesn't matter much, as long as the batching tool is smart enough to minimise wasted space and still produce power-of-two output sheets.

Actually sprites in a sprite sheets don't have to be aligned to anything at all, as long as textures coordinates match. Some atlasing tools are able to generate non-uniform grids, i.e. mixing sprites of different sizes efficiently.
It would be nice with C2 to at least be able to disable the 1px gap when using point sampling.
Image
B
23
S
9
Posts: 237
Reputation: 2,207

Post » Mon Jan 12, 2015 10:43 pm

Refeuh wrote:It would be nice with C2 to at least be able to disable the 1px gap when using point sampling.


Yes, very much so, since when you make a pixel-game, you have the problem of your tiles being 32x32 in size, but your sprites don't fit in, since you have to use 30x30 because of the loss.
Or they do fit in, but that far from being optimal for sprite-sheets.

In any case, I solved the issue by cropping of a looooooot of files. Would have been nice to know that in advance ;)
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Tue Jan 13, 2015 9:04 am

@MultipleChoice https://www.scirra.com/tutorials/577/co ... imisations this may interest you.
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Tue Jan 13, 2015 9:17 am

You can hold ctrl while cropping to remove the 1px transparent border.
Image
B
242
S
29
G
13
Posts: 1,787
Reputation: 18,685

Post » Tue Jan 13, 2015 1:26 pm

@ Aphrodite: Thank you!

@ Tokisom: Not sure, how that helps with this issue. The border (or "bleed") is put aroud the sprites by Connstruct 2 while defining the spritesheets when exporting.

See my game I needed the help for: exit-indie-jumpventure-game-alpha-test_t122540
B
8
S
3
Posts: 197
Reputation: 1,207

Post » Tue Jan 13, 2015 5:20 pm

Oh, sorry. I hadn't realized C2 creates a 1px border on export regardless of source image cropping.
Image
B
242
S
29
G
13
Posts: 1,787
Reputation: 18,685

Next

Return to Construct 2 General

Who is online

Users browsing this forum: Glyfos and 2 guests