SKTextureFilteringMode

Downloaded Xcode 7 beta to try it out and discoverd when setting an SKTextures filtering mode to nearest it does not work (as in there are no visible results when running the app, I still see blurred pixels). Simple example below:


let texture = SKTexture(imageNamed: "image")
texture.filteringMode =.Nearest
let sprite = SKSpriteNode(texture: texture)
addChild(sprite)


Just wondered if this was a known issue with this beta or it's just happening to me?


Thanks,


Tom

Accepted Answer

I'm seeing exactly the same thing.

Thank you for replying, nice to know it's not just me. I find it strange this hasn't been discussed more.

I have the same problem. Do you know if a bug has been filed?


Does somebody know a workaround?

I'm working an a pixel based game and all my assets are blurry too.

I already files a radar (rdar://21326246) for it in Beta 1.

I hope it will get solved in the release version.

Me too – I posted this a while ago: https://forums.developer.apple.com/thread/9462


The same project with identical code seems to respect "nearest" filtering in iOS 8, but ignores it in iOS 9.

Same proble here. With the XCode 7 Beta 3.


Here I posted today: https://forums.developer.apple.com/message/34361#34361


In fact I tried to use atlas and nothing. It cant find the atlas neither. This is my code:

let atlas = SKTextureAtlas(named: "backgrounds")
      let texture = atlas.textureNamed("Background")
      let background = SKSpriteNode(texture: texture)

Sorry... I meant XCode 7 Beta 4

Guys I got it.


I put the the PNG's files inside Assets.xcassets directly and everything worked perfect. Even better, if you right-click over it you can create your new Sprite Atlas and put inside the elements that you want. So, this is the new way of doing things (at least at the moment).


This has been a long day... but at the end it was worth it.

iostony– This isn't the same problem Tomoso described. He was trying to eliminate blur on properly-loaded SKTextures by setting their filteringMode property to SKFilteringModeNearest.

Hi,


I tried exeactly what you did. I moved all my assets from .atlas folders to xcassets files and in the files I created sperate sprite atlasses.

I have one small pixel sized screen that I upscale. The positions are now correct, but the assets are still blurry.

In my code I read the .sks files and correct the filteringMode like this:

[(SKSpriteNode*)node texture].filteringMode = SKTextureFilteringNearest;

But it looks like that is still broken. Any other ways of scaling assets without the blurry side effect?

SKTextureFilteringMode
 
 
Q