Hello Guest

Author Topic: Extra transparent border in atlas?  (Read 16937 times)

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Extra transparent border in atlas?
« Reply #15 on: November 20, 2015, 10:53:36 am »
yeah , the 1% opacity trick makes a lot of sense, the problem is you have to add that extra pixel for each sprite in photoshop which is a lot of work

unless... now that you i read again , you say you add 1 pixel at the border of the sheet document? that will make the tk2d trimming useless and you will waste a lot of space in the atlas, if you want that better go to collection settings and click "Disable Triming"

oug

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Extra transparent border in atlas?
« Reply #16 on: November 23, 2015, 09:53:46 am »
That makes much more sense. I'll switch between the two, see which works best.

I've used an exaggerated example btw (to see if it would work). My real PNG only has 2px of useless alpha space on top and bottom (the PNG is 128x128, so I think it will be fine. But adding only 1px of alpha space and set the trimming to false might be better.

Anyway, thanks!

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Re: Extra transparent border in atlas?
« Reply #17 on: December 30, 2015, 12:12:23 pm »
i have found where i made the hack!, its on tk2dSpriteCollectionBuilder search for

         int w1 = x1 - x0 + 1;
         int h1 = y1 - y0 + 1;

that should be in line 377 (latests tk2d version), leave that untouched, and right after those two lines write these

         x0 --;
         y0 --;
         w1 = w1 + 2;
         h1 = h1 + 2;

those 4 new lines will make the sprite trimmer to include one more line of transparent pixels on each side, up, down , left and right so you can make your sprite sheets with enough free space on each cell, don't you worry about wasted memory cause the trimming will cut that away but now leaving one pixel on each side.

ISSUE: if you make a sprite which it's border touches the limit of the document or the cell (in a sprite sheet), meaning you don't leave any transparent pixels on its sides, you will not only get the usual stupid rotation artifacts but also the sprite won't show correctly sized by one pixel all of it.