Art of Illusion



To Documentation Index
Prev: Example Textures

10. Example Materials

In this chapter, we present some examples of procedural materials. You create them exactly the same way you create procedural textures: select "Materials..." from the "Scene" menu, click "New", and select "Procedural" as your material type.

Example 1: Fire

Our first example is a fire material:

Here is the procedure:

A Turbulence function is used to select a color, ranging from white (for the hottest parts of the flame) through yellow and red to black (for the coolest parts). Note that the Y coordinate is multiplied by 0.5 to stretch the flames in the vertical direction. The same turbulence function is used to determine the density of the material, so that the hottest parts (which would be giving off the most light) are most opaque.

The turbulence function is multiplied by a decreasing function of Y, so that the flames fade away to black at their tops. In addition, a Polar transform module is used to calculate the distance from the Y axis, and the density is multiplied by a decreasing function of it. This causes the fire to smoothly fade away at its edges.

The Transparency color is set to a very dark gray (hue = 0, saturation = 0, value = 0.05). This makes the fire mostly but not entirely opaque. On the other hand, the "Casts Shadows" option in the Properties window is turned off - fire should give off light, not absorb it.

The stone texture, of course, is also procedural. It is simply a Turbulence function going into a custom color function.

Example 2: Fur

Our second example is a little more complex: animal fur. This is traditionally one of the most difficult things to model in 3D programs. Many approaches have been tried, and volumetric ones (such as this) are generally among the most successful.

The central module in this procedure is the Grid module (with a grid spacing of 0.2). Its output is compared to 0.03, which determines the density of the material: 1 for points within this distance of a grid point, 0 for other points. This would produce a grid of small spheres, except that the Y input of the Grid module is set to 0, so that the spheres are stretched out into infinitely long rods. We then cut off the rods at a fixed height by multiplying the density by 0 whenever Y is greater than 0.5.

The Jitter module randomly perturbs the coordinates, so that instead of perfectly straight rods we get randomly varying wavy hair. Also note the Add module which sets the X input of the Grid module to X+Y. This gives an overall slant to the hair, which is typical of animal fur.

The transparency color may look like black, but it isn't quite. It actually has red, green, and blue components each equal to 0.000001. That may seem like an insignificant difference, but actually it is very important. If the components were exactly 0, the hairs would be solid colored and absolutely opaque. Allowing a tiny bit of transparency makes the thin hairs mostly but not entirely opaque, and allows for subtle shading within each hair based on reflected light.

Speaking of reflected light, notice that the eccentricity is set at 0.5. Setting it to a positive value causes light to be predominantly scattered in the backward direction (opposite to the direction the light is coming from). Thus, the hair is brightly lit when the light is behind the viewer, and dark when it is between the light source and the viewer, as expected for mostly opaque, reflective fur.

The Integration Step Size in the Properties window is set to 0.02. This small value is required by the fine details that have to be resolved (the radius of each hair being only 0.03).

Prev: Example Textures