How to change filtering mode for SKEmitterNode texture?

I want to set nearest filtering for particles.

This code does not work:

    let emitter = SKEmitterNode(fileNamed: "fire")!
    let particleTexture = emitter.particleTexture!
    particleTexture.filteringMode = .nearest

Replies

Well, no one know how to do that right? Or it is just not working?

p.s. The more i know about spritekit, the more i think it's broken down in almost every single part.

>> This code does not work


You aren't going to get much interest in a problem where you simply say "my code does not work". That could mean any of a number of things.


In this case, I don't know the answer from my own experience, but the documentation for SKEmitter node (https://developer.apple.com/documentation/spritekit/skemitternode) says in its first paragraph:


"… particles differ from sprites in two important ways:

• A particle’s texture is always stretched uniformly.

• …"


That would lead me to believe the "filteringMode" property of the texture is ignored.

Thanks.

>> That would lead me to believe the "filteringMode" property of the texture is ignored.

But why?! Any other engine i know respect texture filtering everywhere. Because why not? Such important property...

>> But why?!


Given that I'm not in a position to know the real answer, it seems reasonable to assume that this is done to limit the resource requirements of Sprite Kit. Originally, especially on iOS, that would include CPU/GPU usage, but even in the face of hardware performance improvements in the last few years, it still include power consumption.


It's not hard to see that Sprite Kit is a "middle of the road" library, which does a good-enough job for many scenarios (and, especially, provides a very accessible entry point to the techology for developers at all levels, which in some ways is a more important consideration). Once you outgrow that, your correct course is probably to drop down to the Metal layer directly, or to use a 3rd party engine (such as Unreal?) that does.


As always, you should submit a bug report asking for the missing functionality, along with a use-case that justifies your argument, if possible. You can't assume that anyone from the Sprite Kit team will read your comments here.