Author Topic: Sliced Sprite edges Blurring  (Read 6044 times)

Dmitri

  • Guest
Sliced Sprite edges Blurring
« on: September 12, 2012, 02:10:26 PM »
I have a Photoshop texture of a white rectangle with a one pixel colored edge. It's small, 16 x 16, but that should be enough. All of the information is there.

It is part of an Ngui atlas, and the sprite is set with a 1 pixel border all around, but the colored edges are very blurry. When I set the border to 2 pixels, the blurring is lessened, but it's still blurry.

Can I get a true 1 pixel edge that is sharp on screen?

Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sliced Sprite edges Blurring
« Reply #1 on: September 12, 2012, 02:41:30 PM »
Assuming the sprite is pixel-perfect and is using a sliced sprite to draw it, it should be exactly 1 pixel (provided the border is set to 1 pixel). This is true for the current version of NGUI. Free version may behave a bit differently as it's out of date.

phenotype

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Sliced Sprite edges Blurring
« Reply #2 on: September 19, 2012, 06:57:05 PM »
I had a similar problem. I had a two pixel border that was blurry when I set the border to 2. I think that is because the half pixel offset leaves 1/4 of the border on the stretchable part of the sprite. When I set the border to 3 the blurriness went away. So make sure you set the border on the atlas to be at least one pixel greater than the border on your image.

Sinner

  • Guest
Re: Sliced Sprite edges Blurring
« Reply #3 on: November 23, 2012, 09:33:32 AM »
Have the same issue with Pixel perfect positioned Sprites. Is there a possibility for the Atlas to draw an additonal colored border for each sprite that is a copy of its nighbour pixel? (this is usual for a lot of atlases i saw)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Sliced Sprite edges Blurring
« Reply #4 on: November 24, 2012, 01:40:35 AM »
I don't understand what you're trying to do.

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Sliced Sprite edges Blurring
« Reply #5 on: November 24, 2012, 12:50:27 PM »
If you want sharp edges all the time, then you should disable trlinear/bilinear filtering and use point filtering. This will look like crap with most things though.

It's the way tri/bilinear filtering works - it filters the outermost pixel with a pixel outside the actual sprite. Will it help if you can add 1 pixel border of color(color of adjacent pixel) that's outside the sprite border? I'm not sure.

nah0y

  • Sr. Member
  • ****
  • Thank You
  • -Given: 1
  • -Receive: 2
  • Posts: 430
  • \o/
    • View Profile
Re: Sliced Sprite edges Blurring
« Reply #6 on: November 25, 2012, 07:33:39 AM »
Also, make sure you're not compressing the atlas, but using the True Color format.