---
title: "init(noiseWithSmoothness:size:grayscale:)"
framework: spritekit
role: symbol
role_heading: Initializer
path: "spritekit/sktexture/init(noisewithsmoothness:size:grayscale:)"
---

# init(noiseWithSmoothness:size:grayscale:)

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

## Declaration

```swift
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

Return Value A new noise texture.

## Discussion

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:) with smoothness values of 0.0, 0.5 and 1.0. 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) }

## See Also

### Noise Textures

- [init(vectorNoiseWithSmoothness:size:)](spritekit/sktexture/init(vectornoisewithsmoothness:size:).md)
