Author Topic: Atlas-update problem  (Read 17841 times)

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Atlas-update problem
« on: April 23, 2012, 05:37:14 AM »
Hey there!

I'm currently experiencing a lot of problems when updating my atlas, since it moves all parts around and messes up my manually changed mOuter&mInner rectangles. For example, a manually configured tiled square, changes back to it's automatically set rectangles, which forces me to manually change it again. With one texture this wouldn't be a problem, however, with more textures this will cost too much time when later in my projects I have to make changes to the Atlas.

Any way to fix this bug - (is it a bug?)

Cheers,

Ivo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas-update problem
« Reply #1 on: April 23, 2012, 01:22:37 PM »
Why are you specifying coordinates manually? Values adjusted by selecting the atlas in the inspector and modifying them will persist (setting up a border for example). Anything you do via code will not.

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Atlas-update problem
« Reply #2 on: April 23, 2012, 09:02:19 PM »
Hey Arenmook,

By manually I mean by adjusting values in the Atlas through the inspector window. However, when adding new textures to the Atlas, the complete Atlas can reform and therefor move all currently used textures around. This is where I'm experiencing problems, the Outer Rect and Inner Rect which I changed in the Inspector, are not positioned in the same way.

Cheers,

Ivo

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas-update problem
« Reply #3 on: April 23, 2012, 10:32:06 PM »
Inner rects (border) get preserved for sure, even if you update the same texture with another one of slightly different dimensions. Are you saving the scene after modifying the atlas? What version are you using?

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Atlas-update problem
« Reply #4 on: April 24, 2012, 12:28:13 AM »
I'm currently using version 1.61, since I added some personal modifications and I didn't want to port those to the new version yet.
Would you happen to know if this is an issue which is fixed in the later version? I might consider porting all my modified scripts.

Also, to contribute to the possibilities of NGUI I could perhaps send you some scripts which I wrote, it could be useful for updated versions of NGUI. Let me know if you're interested.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas-update problem
« Reply #5 on: April 24, 2012, 02:27:53 AM »
Yup you definitely need to update. This issue was resolved a very long time ago. First thing's first -- update. I wonder how many of the changes you've added are already a part of NGUI. After that, sure, you can send me any change suggestions you like, although I can't promise anything. :)

ivomarel

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 53
    • View Profile
Re: Atlas-update problem
« Reply #6 on: April 24, 2012, 03:17:29 AM »
Hey I can actually see that your free edition goes up to version 1.68b. Is there any free version of NGUI 2.x?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Atlas-update problem
« Reply #7 on: April 24, 2012, 02:01:21 PM »
Nope. Free version remains at 1.68.

Jerware

  • Guest
Re: Atlas-update problem
« Reply #8 on: June 14, 2012, 10:05:02 PM »
I'm sorry to resurrect this thread but I have a similar problem, only I'm using the latest version of NGUI 2.0.8.

If I adjust the outer rectangle of a sprite using the Inspector, it gets saved and works perfectly... until I add/update any texture in the atlas. Then the texture gets totally cropped to the new border I had assigned. You might think this wouldn't be a problem, but the reason I'm bringing the edges (outer rectangle) in is to avoid the effects of Trilinear filtering on "pixel" textures without changing the filtering type to point. I import an 8x8 pure white PNG and bring its edges in so the texture gets mapped as solid white. (Without doing this the edges fade to transparent.)

Any suggestions?

loopyllama

  • Guest
Re: Atlas-update problem
« Reply #9 on: June 14, 2012, 11:12:01 PM »
Change the padding variable in the atlas maker.

Jerware

  • Guest
Re: Atlas-update problem
« Reply #10 on: June 15, 2012, 12:09:59 AM »
Change the padding variable in the atlas maker.

I appreciate the response but I tried a padding value of 4 and it didn't help. I've attached two screenshots that illustrate the problem. The first image is the imported 8x8 PNG with adjusted dimensions. The second is what happens if I Add/Update ANY sprite in the atlas -- it crops the sprite to my adjusted 6x6 dimensions, leaving the filtered edge.

loopyllama

  • Guest
Re: Atlas-update problem
« Reply #11 on: June 15, 2012, 01:43:33 AM »
Interesting. I use the old 2.0.7c version and I do not get this behaviour. Someone else will have to chime in...

PhilipC

  • Guest
Re: Atlas-update problem
« Reply #12 on: June 15, 2012, 08:43:39 AM »
Is the textures that is actually being used (like the final texture) changing size when you add the new sprite? Maybe it is having trouble repacking the texture? (this is just a guess though).

Jerware

  • Guest
Re: Atlas-update problem
« Reply #13 on: June 15, 2012, 10:43:30 AM »
Yes, the source PNG is unchanged. In fact, if I delete the sprite from the atlas and re-add it, it gets imported as the correct 8x8 size. Can you not reproduce this problem?

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Atlas-update problem
« Reply #14 on: June 15, 2012, 02:51:35 PM »
This is the way filtering works. If unity's atlas builder was better, it would be able to extrude 1 pixel of the color next to it, so that it would filter against that color, instead of transparent. But alas.

Getting a all white box can be done by doing a 3x3 white box, with a border on all sides of 1px. I use that all the time.