Procedural texture

(Redirected from Procedural textures)
A procedurally generated floor grate texture

In computer graphics, a procedural texture is a texture created using a mathematical description (i.e. an algorithm) rather than directly stored data. The advantage of this approach is low storage cost, unlimited texture resolution and easy texture mapping.[1] These kind of textures are often used to model surface or volumetric representations of natural elements such as wood, marble, granite, metal, stone, and others.

Usually, the natural look of the rendered result is achieved by the usage of fractal noise and turbulence functions. These functions are used as a numerical representation of the "randomness" found in nature.

Solid texturing

Solid texturing is a process where the texture generating function is evaluated over ${\displaystyle R^{3}}$ at each visible surface point of the model so the resulting material properties (like color, shininess or normal) depends only on their 3D position, not their parametrized 2D surface position like in traditional 2D texture mapping. Consequently, solid textures are unaffected by distortions of the surface parameter space, such as you might see near the poles of a sphere. Also, continuity between the surface parameterization of adjacent patches isn't a concern either. Solid textures will remain consistent and have features of constant size regardless of distortions in the surface coordinate systems.[2] Initially these functions were based on simple combination of procedural noise functions like Simplex noise or Perlin noise. Currently a vast arsenal of techniques are available, ranging from structured regular texture (like a brick wall), to structured irregular textures (like a stonewall), to purely stochastic textures.[3]

Cellular texturing

Cellular texturing differs from the majority of other procedural texture generating techniques as it does not depend on noise functions as its basis, although it is often used to complement the technique. Cellular textures are based on feature points which are scattered over a three-dimensional space. These points are then used to split up the space into small, randomly tiled regions called cells. These cells often look like "lizard scales", "pebbles", or "flagstones". Even though these regions are discrete, the cellular basis function itself is continuous and can be evaluated anywhere in space.[4]

Genetic textures

Genetic texture generation is highly experimental approach for generating textures. It is a highly automated process that uses a human to completely moderate the eventual outcome. The flow of control usually has a computer generate a set of texture candidates. From these, a user picks a selection. The computer then generates another set of textures by mutating and crossing over elements of the user selected textures.[5] For more information on exactly how this mutation and cross over generation method is achieved, see Genetic algorithm. The process continues until a suitable texture for the user is generated. This isn't a commonly used method of generating textures as it's very difficult to control and direct the eventual outcome. Because of this, it is typically used for experimentation or abstract textures only.

Self-organizing textures

Starting from a simple white noise, self-organization processes lead to structured patterns - still with a part of randomness. Reaction-diffusion systems are a good example to generate such kind of textures. Realistic textures can be generated by simulations of complex chemical reactions within fluids. It is believed that these systems show behaviors which are qualitatively equivalent to real processes (Morphogenesis) found in nature, such as animal markings (shells, fish, wild cats...).

Example of a procedural marble texture

(Taken from The Renderman Companion Book, by Steve Upstill)

``` /* Copyrighted Pixar 1988 */
/* From the RenderMan Companion p. 355 */
/* Listing 16.19  Blue marble surface shader*/

/*
* blue_marble(): a marble stone texture in shades of blue
* surface
*/

blue_marble(
float   Ks    = .4,
Kd    = .6,
Ka    = .1,
roughness = .1,
txtscale = 1;
color   specularcolor = 1)
{
point PP;            /* scaled point in shader space */
float csp;           /* color spline parameter */
point Nf;            /* forward-facing normal */
point V;             /* for specular() */
float pixelsize, twice, scale, weight, turbulence;

/* Obtain a forward-facing normal for lighting calculations. */
Nf = faceforward( normalize(N), I);
V = normalize(-I);

/*
* Compute "turbulence" a la [PERLIN85]. Turbulence is a sum of
* "noise" components with a "fractal" 1/f power spectrum. It gives the
* visual impression of turbulent fluid flow (for example, as in the
* formation of blue_marble from molten color splines!). Use the
* surface element area in texture space to control the number of
* noise components so that the frequency content is appropriate
* to the scale. This prevents aliasing of the texture.
*/
PP = transform("shader", P) * txtscale;
pixelsize = sqrt(area(PP));
twice = 2 * pixelsize;
turbulence = 0;
for (scale = 1; scale > twice; scale /= 2)
turbulence += scale * noise(PP/scale);

if (scale > pixelsize) {
weight = (scale / pixelsize) - 1;
weight = clamp(weight, 0, 1);
turbulence += weight * scale * noise(PP/scale);
}

/*
* Magnify the upper part of the turbulence range 0.75:1
* to fill the range 0:1 and use it as the parameter of
* a color spline through various shades of blue.
*/
csp = clamp(4 * turbulence - 3, 0, 1);
Ci = color spline(csp,
color (0.25, 0.25, 0.35),      /* pale blue        */
color (0.25, 0.25, 0.35),  /* pale blue        */
color (0.20, 0.20, 0.30),  /* medium blue      */
color (0.20, 0.20, 0.30),  /* medium blue      */
color (0.20, 0.20, 0.30),  /* medium blue      */
color (0.25, 0.25, 0.35),  /* pale blue        */
color (0.25, 0.25, 0.35),  /* pale blue        */
color (0.15, 0.15, 0.26),  /* medium dark blue */
color (0.15, 0.15, 0.26),  /* medium dark blue */
color (0.10, 0.10, 0.20),  /* dark blue        */
color (0.10, 0.10, 0.20),  /* dark blue        */
color (0.25, 0.25, 0.35),  /* pale blue        */
color (0.10, 0.10, 0.20)   /* dark blue        */
);

/* Multiply this color by the diffusely reflected light. */
Ci *= Ka*ambient() + Kd*diffuse(Nf);

Oi = Os;
Ci = Ci * Oi;

/* Add in specular highlights. */
Ci += specularcolor * Ks * specular(Nf,V,roughness);
}
```