Wolfram Research

Function Repository Resource:

FractalCellularTexture

Source Notebook

Generate Worley's cellular texture

Contributed by: Wolfram Research Staff, based on work by Arnie Cachelin

ResourceFunction["FractalCellularTexture"][{c1,c2,c3,c4},n,distfunc]

generates a texture with nearest-neighbor distance functions with weights c1,c2,c3 and c4 and n fractal octaves, using a distance function distfunc.

Details and Options

In the synthesis of natural-looking textures, it is common to mimic the self-similarity found in many natural (fractal) systems by mixing copies of a synthetic texture generated at different scales. A "fractal" texture is typically produced by summing the first few "octaves" of a particular texture function. In this case, use Worley's cellular texture, which combines the first few nearest-neighbor distance functions, F1 to F4, for a set of random feature points.
Given a set of random feature points, compute the distance from any point x to the nearest feature point. Call this nearest-feature distance function F1. The function that returns the distance to the second-nearest feature is F2, and the nth nearest-feature distance, Fn. Cellular textures, Worley observed, can be generated from linear combinations of the first few Fn. Producing fractal versions of these texture functions can reproduce interesting, natural-looking textures with minimal information input.

Examples

Basic Examples

Generate a cellular texture:

In[1]:=
ResourceFunction["FractalCellularTexture"][{0, 2, 0, 0}, 3]
Out[1]=

Options

DistanceFunction

Choose a DistanceFunction:

In[2]:=
ResourceFunction["FractalCellularTexture"][{1, 2, 0, -1}, 4, DistanceFunction -> ManhattanDistance]
Out[2]=

ColorFunction

Use any kind of ColorFunction:

In[3]:=
ResourceFunction["FractalCellularTexture"][{2, 1, 1, 0}, 3, ColorFunction -> "Aquamarine"]
Out[3]=

Requirements

Wolfram Language 11.3 (March 2018) or above

Resource History

Source Metadata

License Information