Author Topic: NGUI Tiled Sprite producing alpha border  (Read 6935 times)

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
NGUI Tiled Sprite producing alpha border
« on: October 18, 2013, 05:15:43 AM »
I am creating a tile sprite using this texture (see upload). When I go to create an atlas with the texture it creates a alpha border around it. Adjusting the atlas maker options does not do anything to solve this.

I can't trim the image either as then it won't repeat properly.

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #1 on: October 18, 2013, 05:36:56 AM »
The atlas creation with 2.7.0 seems to adds a half pixel smoothing to the edges of the sprite in an atlas. How do I disable this?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #2 on: October 18, 2013, 04:39:41 PM »
First of all, don't use such small images for tiled sprites. You're creating way too many vertices this way. Second, give your sprite a 1 pixel border. This will get rid of the lines. Lastly, plan for this border in your sprite texture.

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #3 on: October 20, 2013, 03:45:40 PM »
Can you recommend an optimal image size for repeating textures?

Also why do I have to account for the alpha border in all my textures? Can't I just disable the feature?

Cheers.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #4 on: October 20, 2013, 04:16:47 PM »
Disable what feature? The way filtering works on graphics cards, there will always be slight smoothing around the edges of whatever you draw, with pixels bleeding in. The idea of giving it a border is to ensure that the pixels that bleed in are the same as the pixels that you're drawing. This way they are invisible.

If you want to know more about this, google Texture Filtering: http://en.wikipedia.org/wiki/Texture_filtering

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #5 on: October 21, 2013, 01:35:55 AM »
Alrighty.

Can you recommend an optimal image size for repeating textures?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #6 on: October 21, 2013, 01:12:30 PM »
I'm not sure how else to say the same thing I already said: Give your sprite a border. That's the only way to fix this.

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #7 on: October 22, 2013, 01:45:08 AM »
I'm not sure how else to ask the same thing I have already asked.

First of all, don't use such small images for tiled sprites.

Alrighty.

Can you recommend an optimal image size for repeating textures?

"Give your sprite a border" does not answer my question.
« Last Edit: October 22, 2013, 03:04:38 AM by DZP »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #8 on: October 22, 2013, 03:23:56 AM »
There's no optimal size for repeating textures. Each time it repeats, it costs 2 triangles, so if you have it very small, it will be high in polycount instead. It's a balancing act. If you have speed to spare on the poly count side, bu no memory then use a very small texture . If you're starved for poly performance but have plenty of memory, then use a larger texture.

ikuniojp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 29
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #9 on: October 22, 2013, 04:09:06 AM »
Or Like me old school,
16x16
32x32
64x64
128x128
256x256
It depends on the texture you want to tile,
and how large are you going to tile it.
In your case, your file has transparent border? ???

DZP

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 17
    • View Profile
Re: NGUI Tiled Sprite producing alpha border
« Reply #10 on: October 22, 2013, 04:11:38 AM »
Alright guys, thanks for the advice!

In your case, your file has transparent border? ???

Lol not on our side :p