```wood	- Simulate a wood-grain surface

```

SYNOPSIS

Surface "wood" "Ka" n "Ks" n "Kd" n "roughness" n "specularcolor" c "grain" n "swirl" n "swirlfreq" n "c0" p "c1" p "darkcolor" c

PARAMETERS

```float Ka=1, Ks=0.4, Kd=0.6, roughness=0.2
float grain=5, swirl=0.25, swirlfreq=1
color specularcolor=[1 1 1]
color darkcolor=dependent on surface color
point c0=[0 0 0] c1=[0 0 1]
```

DESCRIPTION

This shader creates a realistic-looking wood. The frequency of the wood grain can be changed with the grain parameter. The relative amount or amplitude of turbulent swirl in the grain is controlled by the swirl parameter, and swirlfreq controls the frequency of this turbulence. Low values of swirl produce more uniform looking wood, while low values of swirlfreq make the wood appear to be more knotty. Obviously these two parameters interact to a large extent. You should be careful not to set swirl too high or swirlfreq too low or the wood will become a jumbled mess.

The wood is simulated by creating a grain that is essentially composed of differently-colored concentric “cylinders” around a central axis defined by the two points c0 and c1. This axis is the z axis by default. Note that the orientation of this axis can be varied either by changing these two parameters or by doing some transformations between the call to the shader and the definition of the geometry. Either one of these approaches may make more intuitive sense in different applications.

The color of the wood will normally consist of bands of different intensities of the surface color. This is the most generally useful way of invoking the shader. However, for special appearances this can be changed by changing the darkcolor parameter, which controls the color of the dark grain of the wood. The different intensity levels are actually levels of mixing between this color and the surface color, so setting the surface color to red and darkcolor to white will produce red wood with white grain and various shades in between.

The parameters Ka,Ks and Kd have the usual meanings of ambient, specular and diffuse reflective intensities, respectively. roughness and specularcolor control the sharpness and color of the specular highlight.