<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SpriteKit",
  "identifier" : "/documentation/SpriteKit/SKTexture/init(noiseWithSmoothness:size:grayscale:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SpriteKit"
    ],
    "preciseIdentifier" : "c:objc(cs)SKTexture(cm)textureNoiseWithSmoothness:size:grayscale:"
  },
  "title" : "init(noiseWithSmoothness:size:grayscale:)"
}
-->

# init(noiseWithSmoothness:size:grayscale:)

Creates a new texture whose contents are procedurally generated color noise data.

```
convenience init(noiseWithSmoothness smoothness: CGFloat, size: CGSize, grayscale: Bool)
```

## Parameters

`smoothness`

A value that indicates how similar neighboring texels will be in the resulting texture. The value should be between `0.0` and `1.0`. A value of `1.0` generates a smooth surface.

`size`

The size of the new texture in points.

`grayscale`

If <doc://com.apple.documentation/documentation/Swift/true>, all four components of each texel will have equal values. If <doc://com.apple.documentation/documentation/Swift/false>, all four values are completely randomized.

## Return Value

A new noise texture.

## Discussion

Unlike other textures produced by SpriteKit, the texels are not premultiplied by the alpha value. Your custom shaders should compensate for this as necessary.

The following Swift code creates three sprite nodes with textures generated by

[`init(noiseWithSmoothness:size:grayscale:)`](/documentation/SpriteKit/SKTexture/init(noiseWithSmoothness:size:grayscale:))

with smoothness values of `0.0`, `0.5` and `1.0`.

```swift
let columWidth = scene.size.width / 3

for i in 0...2 {
    
    let size = CGSize(width: ceil(columWidth),
                      height: 0.5 * scene.size.height)
    
    let smoothness = CGFloat(i) / 2
    
    let noiseTexture = SKTexture(noiseWithSmoothness: smoothness,
                                  size: size,
                                  grayscale: false)
    
    let sprite = SKSpriteNode(texture: noiseTexture, size: size)
    
    sprite.position = CGPoint(x: CGFloat(i) * columWidth + (columWidth / 2),
                              y: scene.size.height / 2)
    
    scene.addChild(sprite)
}
```

![Noise with smoothness values of 0.0, 0.5 and 1.0](images/com.apple.spritekit/media-2663444@2x.png)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)