Author Topic: Asset to Atlas texture problem  (Read 6416 times)

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Asset to Atlas texture problem
« on: April 18, 2012, 02:28:06 AM »
Hey guys,

I have a problem whenever I get a picture from my assets folder to the Atlas, it's the same. However, when I use it in my project as a panel/button, it actually seems to add some kind of smoothener to the sides of the picture, with and alpha which makes it fade it out. This is only one pixel-wide and barely visible usually, but in my case I have to get rid of this little line.

I just want the exact texture which I have on my computer to be on my sprites.

Did anyone encounter the same problem?

Cheers,

Ivo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #1 on: April 18, 2012, 02:39:19 AM »
You might have a neighbour sprite being visible through. This happens when you zoom in on the texture and don't use pixel-perfect coordinates. Solution: either use pixel-perfect coordinates, or increase the padding when creating your atlas in the Atlas Maker tool.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Asset to Atlas texture problem
« Reply #2 on: April 18, 2012, 03:02:00 AM »
Hey ArenMook,

Thanks for the quick reply, but I think it's something else. I sent a screenshot to show what it looks like.
It seems like it's a setting...

Cheers,

Ivo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #3 on: April 18, 2012, 03:03:30 AM »
I don't see anything wrong with that screenshot. Zoom in on any texture with transparency far enough and you will get blending like that.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Asset to Atlas texture problem
« Reply #4 on: April 18, 2012, 03:49:53 AM »
Ok let me show you a different screenshot which show's my problem more clear. This sprite is a tiled sprite, created from a picture which is 2x2 pixels (white). This is what happens if I tile. With larger picture (40x40) this same problem occurs.

What am I doing wrong?

 

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #5 on: April 18, 2012, 03:51:13 AM »
If you look into how the tiled sprite works, you will see that it tiles the inner rectangle. You need to specify a border for your sprite to create it. 1 pixel is usually enough.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Asset to Atlas texture problem
« Reply #6 on: April 18, 2012, 04:10:19 AM »
Hey,

I apologize for my lack of knowledge of the NGUI classes, but I can't seem to find how to adjust this border. Is it necessary to adjust the NGUI code? There doesn't seem to be any option in the interface panels.

Ivo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #7 on: April 18, 2012, 04:12:09 AM »
Nope, just select your atlas, and you will have a drop-down list of all the sprites in that atlas. Select the sprite in question, and modify its border.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Asset to Atlas texture problem
« Reply #8 on: April 18, 2012, 04:26:06 AM »
ArenMook, thank you so much! I would not have been able to figure this out on myself....

Small note for others who might have the same problem though, it's actually the outer which is used by Tiled Sprite.

Thanks again!!! (also for the fast replies)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #9 on: April 18, 2012, 04:29:02 AM »
No, it's inner. Line 52 of UITiledSprite:

  1. Rect rect = mInner;

The outer rect isn't used by the tiled sprite -- to draw it anyway.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Asset to Atlas texture problem
« Reply #10 on: April 18, 2012, 05:48:42 AM »
Ah I'm using version 1.60 -> line 58

Rect rect = mOuter; 

:P I should update

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Asset to Atlas texture problem
« Reply #11 on: April 18, 2012, 06:51:52 AM »
1.60 is like... 2.5 months old. Yes. Yes you should.