Type Method

textureWithNoiseMap:

Creates a texture from the specified noise map.

Declaration

+ (instancetype)textureWithNoiseMap:(GKNoiseMap *)noiseMap;

Parameters

noiseMap

The noise map object from which to generate a texture.

Return Value

A new texture based on the contents of the noise map.

Discussion

The GKNoiseMap class encapsulates the output of procedural noise generation and processing. You use noise sources (the GKNoiseSource class cluster), noise objects (the GKNoise class), and noise maps to generate, process, and combine styles of noise, then use this method to create a graphical representation of the noise for use as a texture image in your game. Noise textures can be useful for imitating natural phenomena such as clouds, stone surfaces, and wood grain. You can also use noise textures as normal maps to make surfaces appear more natural under lighting.

This method colorizes the generated texture using the gradientColors property of the GKNoise object from which the noise map was created. By default, that property specifies a simple grayscale ramp, but you can change it to create more colorful textures. When you use the noiseWithComponentNoises:selectionNoise: method to combine noise objects, each component noise object keeps its original colors, and the selection noise determines which component noise’s colors appear in which areas of a generated texture.