diaknurl - Cut a diamond knurl pattern into a cylindrical object
Displacement "diaknurl" "maporigin" p "xaxis" p "yaxis" p "zaxis" p "freq" n "depth" n "width" n "radius" n "zmin" n "zmax" n "dampzone" n
point maporigin=[0 0 0] point xaxis=[1 0 0] yaxis=[0 1 0] zaxis=[0 0 1] float freq=10, depth=0.25, width=0.05 float radius=1/(2*PI) float zmin=-1e20 zmax=1e20 dampzone=0
This shader cuts a diamond knurl pattern into a cylindrical object. The parameters maporigin, xaxis, yaxis, and zaxis are used to do a cylindrical projection as described in maps(3sh).
The freq parameter gives the number of grooves to cut per unit length along the z axis: the higher the value is, the closer the grooves will be. The depth parameter controls the depth of the grooves, and the width parameter controls the width of the grooves. In order to render a correctly diamond-shaped pattern, the radius (in shader space) of the cylindrical object must be passed with the radius parameter.
By default, the diamond knurl will be rendered along the entire length (along the z axis in shader space) of the cylinder. However, you can set minimum and maximum bounding z values with the zmin and zmax parameters. The surface will not have a knurl pattern cut outside these boundaries. In addition, you can make the knurl smoothly fade out instead of abruptly stopping at these boundaries by setting the dampzone parameter. This parameter controls the width of the zone in which the depth of the grooves goes to zero. This zone is inside the zmin and zmax boundaries.
Remember to set the displacement bounds attribute when using this shader.
This shader can experience severe aliasing.
Pixar Animation Studios
|