Archive 17/01/2023.

Sprite/Texture Nearest Neighbour Filtering

qwertysam

Hello! So my question is quite simple to ask (perhaps more difficult to answer); is it possible to select the type of filtering that applies to my StaticSprite2D objects?

For example, this is what I’ve been working on:

The ship looks great. What I want is a 23 pixel high image that I can scale up by 4 in the code to achieve a 92 pixel high result on the screen. When I do that, this is the result that I get:

Screenshot from 2017-08-05 13-24-13

Pretty gross, right? It appears to be using a Linear or Cubic scaling algorithm, which is not what I want. I would like to tell it to use a Nearest Neighbour scaling algorithm so that I can get those crisp pixels that will compliment the art. After about a week of searching, the documentation left me struck with no leads.

My current workaround is to scale the image before-hand and load up a much larger image to be rendered. It’s quite extraneous and not particularly fun or optimised for loading.

Is there any proper or better solution that I’m missing?

Thanks!

Modanung

Try this:

And welcome to the forums! :slight_smile:

qwertysam

Thank you so much for your help!

kostik1337

Well, this already has an answer, but I’d like to add - I fixed the same problem with
engineParameters_["TextureFilterMode"] = FILTER_NEAREST;
at Setup() of your Application, this sets filtering type for all textures, if they don’t have an xml file