Pixel circles when scaling with SKSpriteNode

When you reduce the image around the perimeter, a pixel appears around the circle.

The nested circle image has a radius of 100 pixels. (The circle is white, so click around the space bar and you get an image.) Zooming out using SpriteKit makes the border very blurry and pixelated. How to scale up / down and maintain sharp edges in SpriteKit? The goal is to use a basic image for a circle and create circle images of different sizes with this one basic image.

White circle

    // Create dot
    let dot = SKSpriteNode(imageNamed: "dot50")

    // Position dot
    dot.position = scenePoint

    // Size dot
    let scale = radius / MasterDotRadius
    println("Dot size and scale: \(radius) and \(scale)")
    dot.setScale(scale)

    dot.texture!.filteringMode = .Nearest
+4
source share
1 answer

It seems you should use SKTextureFilteringLinearinstead SKTextureFilteringNearest:

SKTextureFilteringNearest:

. , .

SKTextureFilteringLinear:

. , .

SKShapeNode, , , ( ) , SKSpriteNode .

+2

All Articles