Instance Method

displaceXWithNoise:yWithNoise:zWithNoise:

Replaces values in the noise field by shifting each value along a vector whose x-, y-, and z-components are based on the specified noise objects.

Declaration

- (void)displaceXWithNoise:(GKNoise *)xDisplacementNoise yWithNoise:(GKNoise *)yDisplacementNoise zWithNoise:(GKNoise *)zDisplacementNoise;

Parameters

xDisplacementNoise

A noise object whose values determine the x-component of distortion applied to each value in this noise field.

yDisplacementNoise

A noise object whose values determine the y-component of distortion applied to each value in this noise field.

zDisplacementNoise

A noise object whose values determine the z-component of distortion applied to each value in this noise field.

Discussion

For each position in the noise field, this method first constructs a vector by sampling from the same position in the xDisplacementNoise, yDisplacementNoise, and zDisplacementNoise noise objects. Then this method uses that vector to shift the location of the noise value at that position. By applying different types of noise to each parameter, you can create different kinds of distortion effects. For example, passing GKCylindersNoiseSource output to one parameter and GKConstantNoiseSource to the other two, you can add horizontal, vertical, or transverse waves to the noise.

Figure 1

Example result of the displace operation

See Also

Applying Operations that Distort Noise

- applyTurbulenceWithFrequency:power:roughness:seed:

Replaces values in the noise field by applying a randomized distortion effect.