Turbulence effect

Use the turbulence effect to generate a bitmap based on the Perlin noise function.

The turbulence effect has no input image.

The CLSID for this effect is CLSID_D2D1Turbulence.

Example image

Effect example screenshot showing the output of the turbulence effect.

The Turbulence effect computes the sum of one or more octaves of the Perlin noise function. Perlin noise is a pseudo-random function whose value depends on the frequency, position, and seed value. The effect generates the RGBA values using one of these equations.

If you select the D2D1_TURBULENCE_NOISE_FRACTAL_SUM noise mode the effect uses this equation.

The turbulence function used to generate a bitmap.

If you select the D2D1_TURBULENCE_NOISE_TURBULENCE noise mode the effect uses this equation.

The turbulence function used to generate a bitmap.

Note  The PerlinNoise function has a range of [-1, 1].

This effect outputs pixel values in premultiplied alpha.

Effect properties

Display name and index enumerationType and default valueDescription

Offset

D2D1_TURBULENCE_PROP_OFFSET

D2D1_VECTOR_2F

{0.0f, 0.0f}

The coordinates where the turbulence output is generated.

The algorithm used to generate the Perlin noise is position dependent, so a different offset results in a different output. This property is not bounded and the units are specified in DIPs

Note  The offset does not have the same effect as a translation because the noise function output is infinite and the function will wrap around the tile.

BaseFrequency

D2D1_TURBULENCE_PROP_BASE_FREQUENCY

D2D1_VECTOR_2F

{0.01f, 0.01f}

The base frequencies in the X and Y direction.. This property is a float and must be greater than 0. The units are specified in 1/DIPs.

A value of 1 (1/DIPs) for the base frequency results in the Perlin noise completing an entire cycle between two pixels. The ease interpolation for these pixels results in completely random pixels, since there is no correlation between the pixels.

A value of 0.1(1/DIPs) for the base frequency, the Perlin noise function repeats every 10 DIPs. This results in correlation between pixels and the typical turbulence effect is visible.

NumOctaves

D2D1_TURBULENCE_PROP_NUM_OCTAVES

UINT32

1

The number of octaves for the noise function. This property is a UINT32 and must be greater than 0.

Seed

D2D1_TURBULENCE_PROP_SEED

UINT32

0

The seed for the pseudo random generator. This property is unbounded.

Noise

D2D1_TURBULENCE_PROP_NOISE

D2D1_TURBULENCE_NOISE

D2D1_TURBULENCE_NOISE_FRACTAL_SUM

The turbulence noise mode. This property can be either fractal sum or turbulence. Indicates whether to generate a bitmap based on Fractal Noise or the Turbulence function. See Noise modes for more info.

Stitchable

D2D1_TURBULENCE_PROP_STITCHABLE

BOOL

FALSE

Turns stitching on or off. The base frequency is adjusted so that output bitmap can be stitched. This is useful if you want to tile multiple copies of the turbulence effect output.

  • True – The output bitmap can be tiled (using the tile effect) without the appearance of seams. The base frequency is adjusted so that output bitmap can be stitched.
  • False – The base frequency is not adjusted, so seams may appear between tiles if the bitmap is tiled.

 

Noise modes

EnumerationDescription
D2D1_TURBULENCE_NOISE_FRACTAL_SUMComputes a sum of the octaves, shifting the output range from [-1, 1], to [0, 1].
D2D1_TURBULENCE_NOISE_TURBULENCEComputes a sum of the absolute value of each octave.

 

Note  Neither mode contains an explicit clamp of the output values.

Output bitmap

This effect generates a logically infinite sized bitmap.

Requirements

Minimum supported clientWindows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Minimum supported serverWindows 8 and Platform Update for Windows 7 [desktop apps | Windows Store apps]
Headerd2d1effects.h
Libraryd2d1.lib, dxguid.lib

 

Related topics

ID2D1Effect

 

 

Community Additions

ADD
Show:
© 2014 Microsoft