Author Topic: Atlas modification outside Unity  (Read 3727 times)

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Atlas modification outside Unity
« on: November 22, 2012, 02:24:18 PM »
Hello,

Is it safe to open the generated Atlas in Photoshop, modify some things, like adding a shadow to everything etc...

Let's say I've added a stroke of 3px around every sprites on the atlas (not considering the rendering issues were stroke will be cut).
What happen if I then add another sprite ? or delete one ?

As you're not recreating the entire atlas, is this an issue ?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlas modification outside Unity
« Reply #1 on: November 22, 2012, 03:10:03 PM »
If you update the position of the sprite in the atlas to include it, it should be fine.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Atlas modification outside Unity
« Reply #2 on: November 22, 2012, 03:18:08 PM »
thx for the answer but that's not what I want :)

I don't want to include this stroke in my sprites, I want to know if by adding sprites, it will move only the rect associated with this sprite and leave behind on some pixels, the black stroke at the last location.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas modification outside Unity
« Reply #3 on: November 22, 2012, 11:03:20 PM »
You need to make sure that you have enough padding around your characters for the effects you're trying to add. For example for a 1 pixel stroke, you need to have at least 1 pixel of padding on all sides. It's one of the options you can specify when exporting your font with BMFont.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Atlas modification outside Unity
« Reply #4 on: November 23, 2012, 03:10:52 AM »
Okay, still not what I want, let me explain better :)

PS : it's not for a font atlas, but a sprite atlas

This is an optimisation technique, to be able to use those atlases in PVRTC compressed mode and NOT True Color.
If I keep my atlas as is, and just apply the PVRTC compression to it, there is a LOT of artefacts on the border of almost every sprites.
To prevent this, I open the final texture atlas in Photoshop, duplicate the layer, apply it a big stroke of 10px and then set this second layer to opacity 2%. That way, the border is not visible to a human eye (or hardly...) and the algorithm will create artefacts on the image, but on the border ! not the sprite itself.
So I have a really really acceptable quality of image even using compression.

So, you understand that I don't want to add some padding around each sprite, I really want just that stroke of 2px 2% opacity around them.

My question maybe is more, can we reset an entire atlas and recreate it from scratch (of course selecting all the sprites on the atlas). I mean, I really want a clean white sheet before the algorithm place my sprites on it, because well, I have added extra shadow on the background...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas modification outside Unity
« Reply #5 on: November 24, 2012, 01:52:45 AM »
When creating fonts, you need to make sure that the font's RGB channel is pure white. Only alpha should have glyph outlines. By default, RGB channel has color info as well -- you will either see glyph outlines, or you will see white boxes around glyphs on a black background. Both are wrong.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlas modification outside Unity
« Reply #6 on: November 24, 2012, 12:46:20 PM »
Your changes will be lost if it rebuilds the atlas.

If you've finalized everything with the atlas, you can do this, but otherwise you really can't because the atlas maker would undo what you have added.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Atlas modification outside Unity
« Reply #7 on: November 25, 2012, 06:51:13 AM »
When creating fonts, you need to make sure that the font's RGB channel is pure white. Only alpha should have glyph outlines. By default, RGB channel has color info as well -- you will either see glyph outlines, or you will see white boxes around glyphs on a black background. Both are wrong.

lol Aren, once again, this is absolutely not about fonts.
I think Nicki understand exactly what I want, and he is right, i've everything is finalized with the atlas, I can modify the final atlas texture as I like, but I can't touch it anymore after (add or remove sprites in it).

But I think I found a workaround, I keep the "clean" version of the generated atlas, duplicate it, and then modify it as I want. And if I want to change something, I just put back the reference to the clean version!