Initializes a noise map by sampling from the specified noise object, with the specified parameters.
- iOS 10.0+
- macOS 10.12+
- Mac Catalyst 13.0+
- tvOS 10.0+
The noise object from which to create a noise map.
The size of 2D “slice” to take from the unit coordinate space of the noise object.
If you later generate a texture image from the noise map with the
SKTextureclass, this size is also the pixel dimensions of the texture to generate.
The position of the 2D “slice” to take from the unit coordinate space of the noise object.
The width and height of integer grid for sampling noise values from the noise object.
trueto adjust samples taken from the noise object so that generated texture images can be tiled without visible seams;
A new noise map object.
GKNoise objects are lightweight descriptions of noise generation and processing parameters. When you create a noise map from a noise object, GameplayKit performs the computation described by those objects to create a grid of noise sample values. You can then read those values (or interpolated values at non-integral positions on that grid) with the methods listed in Accessing Noise Values, or use the
SKTile classes to generate texture images or tile maps from the generated noise.
The noise field described by a
GKNoise object is inherently three-dimensional and infinite in extent. When you create a noise map from a noise object, GameplayKit samples a “slice” of noise values, whose size and position within the
z = 0 plane of the noise field you specify with the
origin parameters. You can take advantage of these features by using
GKNoise methods to rotate, translate, and scale the noise field before creating a noise map:
Generate wood-grain textures by creating and distorting
GKCylindersoutput, then rotating it to “slice” diagonally along the cylinders.
Use one of the
GKCoherentclasses as the basis for an infinite procedurally-generated game world by translating the noise field, then generating noise maps for areas of the world near the player. Because coherent noise is deterministic, you can discard noise maps when the player leaves an area, and regenerate them when the player comes back.