Hello Guest

Author Topic: Sprite Collections (Optimization techniques)  (Read 5705 times)

Sickwitit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Sprite Collections (Optimization techniques)
« on: July 04, 2015, 05:12:26 pm »
I am faced with a bit of an issue with memory optimization using the tk2d sprite collection. Right now, I have a sprite collection that is fairly large (4096), that is 20mb large.

Every sprite in the sprite collection needs a diffuse material applied. Doing so, inhibits me from modifying certain sprite collection settings without destroying resolution quality.  But, When I take the diffuse material off of each texture in the collection, then apply a material with SolidVertexColor. I then modify the dice filter to transparent. Now, the total atlas size is only 3 mbs.

Besides the common optimization techniques as explained on your documentation, such as, lower dicing, force square, png atlas format, remove duplicates.. etc.. do you have any advice on lowering the atlas size, while keeping the diffuse material on the textures, reducing the memory size?

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Collections (Optimization techniques)
« Reply #1 on: July 05, 2015, 07:13:57 pm »
If you use diffuse shader and lighting, you are pretty much out of luck. Forward lighting in Unity is multipass and you will not be able to do much else there, and you'll be introducing some artefacts here and there.

It sounds like you have large textures with either loads of empty 0 alpha holes, or lots of duplicates that can be removed when dicing. Dicing sounds like the best bet, but if that isn't going to work for you you could split up the textures manually to be more friendly to atlasing without dicing, i.e. don't have large holes in textures, etc.

Sickwitit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sprite Collections (Optimization techniques)
« Reply #2 on: July 06, 2015, 06:30:21 pm »
Thanks for the great info. You are correct, they are actually background textures (pretty large), most having alpha holes. Great point on splitting the textures, but unfortunately, I can't split up the textures, due to early design decisions. Even with dicing it is 20mb. It's definitely the diffusive material applied to each texture causing the issues. Hmmm. I can work with 20mb, but now I know for next time to not create large textures with alpha holes that need diffuse shaders on them, lol?

Thanks.

Sickwitit

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Sprite Collections (Optimization techniques)
« Reply #3 on: July 07, 2015, 07:54:56 pm »
I'm back to this issue because I believe there has to be a workaround to this, wanted to check if it would cause issues in the future first.

What if I just build the large sprite collection with a BlendVertexColor shader applied, dice, which will result in a low memory usage. Then, after the game objects access the sprites in the sprite atlas, switch the shader to Sprites/Diffuse. Do you think this would cause any problems down the road? It would save me at least 17mb of space.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sprite Collections (Optimization techniques)
« Reply #4 on: July 07, 2015, 10:59:52 pm »
The atlas building process doesn't do anything different depending on the shader, you're not going to see any difference.