Instance Method

applyTurbulenceWithFrequency:power:roughness:seed:

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

Declaration

- (void)applyTurbulenceWithFrequency:(double)frequency power:(double)power roughness:(int)roughness seed:(int32_t)seed;

Parameters

frequency

A value that determines how often (per unit area) the amount of distortion changes.

power

A value that determines the magnitude of distortion applied.

roughness

A value that determines the rate of change in distortion amounts over the noise field. Lower values result in smooth transitions between more-distorted and less-distorted regions; higher values result in rapid, rough transitions.

seed

A value that governs the randomization of the turbulence effect. Passing the same seed value for multiple calls to this method results in the same general structure of turbulence (modulated by the other parameters).

Discussion

Applying turbulence randomly distorts areas of the noise field, resulting in more natural-looking textures. This method is equivalent to using the displaceXWithNoise:yWithNoise:zWithNoise: method with three noise fields generated by the GKPerlinNoiseSource class.

Figure 1

Example result of the applyTurbulence operation

The frequency and power parameters are closely related:

  • Low frequency and low power results in very minor changes to the original noise field.

  • Low frequency and high power adds elongated, twisting features to the original noise field.

  • High frequency and low power results in a rougher version of the original noise field.

  • High frequency and high power tend toward completely random noise.

See Also

Applying Operations that Distort Noise

- 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.