Author Topic: Spaces between spliced sprites  (Read 11758 times)

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Spaces between spliced sprites
« on: March 05, 2013, 12:11:10 PM »
Hi guys, has anyone seen this before?

The pictures width is 22 pixels,the images goes right to the edges (see "energyBase" attached) , the sliced sprite is scaled with a width of 22 and instantiated with an x coordinate of +22 each time. The pivot is at the center for each object.

Why do I get a gap between sliced sprites? (see spaces.png)

I have taken the objects out of the NGUI UI object and left them parentless (I changed the scale to 1 for everything and the positions to +1), I get the same issue.

Any ideas?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Spaces between spliced sprites
« Reply #1 on: March 05, 2013, 12:48:13 PM »
Why don't you use a tiled sprite for this? You only need one tiled sprite instead of many sliced sprites. I also suggest giving it a border of 1 so that the tiled sprite has no gaps.

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Spaces between spliced sprites
« Reply #2 on: March 05, 2013, 12:52:46 PM »
Each is a game object that has to be evaluated separately, I guess I could wrap invisible colliders over them. One other problem would be the pictures that come at the end of the begining they are not the same picture file.

What is the reason for this?

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Spaces between spliced sprites
« Reply #3 on: March 05, 2013, 01:30:22 PM »
Also can you elaborate "giving it a border of 1" please? Where do I do this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Spaces between spliced sprites
« Reply #4 on: March 05, 2013, 01:37:22 PM »
There is always going to be blurring at the edges when you zoom in (until Unity 4.2+ texture importing options anyway). I'm also not clear why you used a sliced sprite. Why not a regular sprite, even if you didn't want to use a tiled sprite?

You set the border by selecting "Edit..." from the drop-down (that's also the name of your sprite). Same place you can eliminate padding.

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Spaces between spliced sprites
« Reply #5 on: March 05, 2013, 01:48:20 PM »
O I have tried "sprite" and set the border to 0 and its slightly better but not yet perfect

I dont mind the zoomed in look at all but it looks bad in game, it will randomly draw the lines (see attached)

selzero

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
Re: Spaces between spliced sprites
« Reply #6 on: March 05, 2013, 02:38:24 PM »
It seems that between playing with the edit button and the scale of a widget if its a tiled sprite I can change the way I'm using the atlas, I think I will be able to manipulate it, thanks ArenMook

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Spaces between spliced sprites
« Reply #7 on: March 05, 2013, 03:30:10 PM »
I think it's a half-pixel offset that comes from having an odd size pixel width and centered sprites. Try to left align them and see if that removes the gap.
Otherwise it's the bilinear filtering as arenmook mentioned.

4.2 texture import settings eh.. my interest is piqued.  ;)