Hello Guest

Author Topic: Perhaps two bugs  (Read 4956 times)

echeg

  • Newbie
  • *
  • Posts: 5
    • View Profile
Perhaps two bugs
« on: May 06, 2013, 07:00:07 am »
v 1.92 final

i have 25 images(img1@x1 - img25@x1) and 3 platforms(x1 x2 x4)
in project:
img folder
-x2(folder)
--img1@x2 - img25@x2
-x4(folder)
--img1@x4 - img25@x4
-img1@x1 - img25@x1

first bug
I create a Sprite Collection put Multiple Atlases and Max Size 2048 and Current Platform 1x
I'll get the ONE atlas 1024*1024 for platform x1,  ONE 2048 * 2048 for x2 and ONE 4096*4096 for x4
That is, Platform x4 turned atlases larger than 2048

second bug
In SpriteAnimation Editor Autofill does not work if images in CurrentPlatform have "@1x"
-img1@x1 - img25@x1 - Autofill not work
-img1 - img25 - Autofill work
« Last Edit: May 06, 2013, 07:02:30 am by echeg »

echeg

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Perhaps two bugs
« Reply #1 on: May 06, 2013, 07:12:53 am »
3 bug that is almost like the first.

I create a Sprite Collection put Multiple Atlases and Max Size 2048 and Current Platform 4x
I'll get the
2 atlas 512*512 for platform x1, 
2 1024* 1024 for x2 and
2 2048 *2048 for x4

the expected behavior is probably like:
1 atlas 1024*1024 for platform x1, 
1 2048 * 2048 for x2 and
2 2048 *2048 for x4

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Perhaps two bugs
« Reply #2 on: May 06, 2013, 12:09:44 pm »
v 1.92 final

i have 25 images(img1@x1 - img25@x1) and 3 platforms(x1 x2 x4)
in project:
img folder
-x2(folder)
--img1@x2 - img25@x2
-x4(folder)
--img1@x4 - img25@x4
-img1@x1 - img25@x1

first bug
I create a Sprite Collection put Multiple Atlases and Max Size 2048 and Current Platform 1x
I'll get the ONE atlas 1024*1024 for platform x1,  ONE 2048 * 2048 for x2 and ONE 4096*4096 for x4
That is, Platform x4 turned atlases larger than 2048

second bug
In SpriteAnimation Editor Autofill does not work if images in CurrentPlatform have "@1x"
-img1@x1 - img25@x1 - Autofill not work
-img1 - img25 - Autofill work

1. That is not a bug. The max texture size is scaled for each platform. So if you start with 512x512 for 1x, the max will be 1024 for 2x and 2048 for 4x. Its the only way to do it when you think about it, you have 16x the pixel count and will need 4x texture dimension increase in each dimension to accomodate.
The maximum texture size is for the current platform, not all other platforms. So if you start with 4x textures, and specify max texture size at 2048, then the max texture sizes for 2x = 1024, 1x = 512.

Isn't the real issue that "high end" android devices have max texture size of 2048x2048... You have to account for that yourself, make sure the largest atlas doesn't get larger than 2048x2048 - there isn't much 2D Toolkit can do there, except use multiple atlases, but that is bad in more than one way, explained later.

2. That is a bug. I'll get it sorted for the next release, basically needs to ignore everything behind @ when setting the name in the sprite collection. There should be no difference to setting up the atlas with @4x textures, and @1x textures - the names should not have the @ behind there.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Perhaps two bugs
« Reply #3 on: May 06, 2013, 12:15:47 pm »
3 bug that is almost like the first.

I create a Sprite Collection put Multiple Atlases and Max Size 2048 and Current Platform 4x
I'll get the
2 atlas 512*512 for platform x1, 
2 1024* 1024 for x2 and
2 2048 *2048 for x4

the expected behavior is probably like:
1 atlas 1024*1024 for platform x1, 
1 2048 * 2048 for x2 and
2 2048 *2048 for x4

This is almost exactly what you DONT want, except in very specific cases. When you have spanning on one particular atlas and only that, the draw call count is going to get totally unpredictable. So you're happy with 1 draw call in 1x and 2x, and suddenly because of the ordering of the sprites in 4x, you get one draw call per sprite. It can actually happen quite easily, unless you have very strict restrictions on your sprite setup in the first place - eg. if this is solely for the hero sprite and there is only ever one of them, or other similar situations where you have full control over it.

Either:
1. Factor for the draw call fluctuation yourself by making it span on all the configs
2. Split up your sprite collection so that the spanning is not necessary, and the largest collection(s) fit on one atlas individually.
3. Change the code to allow it. I will be happy to tell you what to change, but I have done my part in warning you of the implications of doing this.