Displacement Shaders actually change the geometry of the object after it is diced into micropolygons, but before the shading is applied. Displacement Shaders are are assigned on a per-object basis. In ShadeTree you must have the Shader Type set to 'displacement' in the Render Options Editor.

Before the renderer calculates the shading of an object, the surface of that object is divided up into tiny individual flat surfaces, called surface elements or micropolygons. Each element is a single plane. This allows the renderer to calculate a normal for that tiny area of the surface. The size of this area can be controlled by the Shading Rate in the Render Options Editor. If you decrease the Shading Rate, more smaller micropolygons are generated for the surface and the closer the rendered surface fits the geometrically defined surface. The purpose of a Displacement Shader is to tell the renderer the new position for each micropolygon. The only operation box required in a Displacement Shader is one of the 'Displacement' boxes:

This box outputs:

• NN the new normal for P.
• R the new reflection vector for P.
• nuP the new position of P.

This single box can actually be a 'Displacment Shader' all by itself. If VAL is not 0, changing the amplitude, AMP will change the size of the entire object. However you may use a pattern or math function to change the micropolygons' position procedurally. Patterns and math functions return floating point values which can be used to vary the amount of displacement across the surface.

This is an example of a simple procedural Displacement Shader:

In this case we're controlling the amount of the displacement using the checks pattern. The output value is either 1 or 0, which turns the displacement on or off. You can control the amplitude of the displacement by changing the AMP value on the displacement box. As you raise the amplitude of the displacement, you will start to notice little "rips" in the rendering. These are caused when the renderer "misses" an intersection with the new surface. To solve this problem, you will want to set the Displace Bound in the Render Options Editor. This will increase the size of the bounding box by the selected percentage. The bounding box of an object is area in the scene where the renderer searches for that object. The rendered image looks like:

You may also use a texture map to control the displacement values across the surface. Since all but single channel maps return a color, you will want to use either one of the 4 channels, red, green, blue, alpha or the intensity or the luminence value of the map.

This is an example of a textured Displacement Shader:

The rendered image looks like:

It is important to remember:
The more intricate the pattern or texture used to generate the displacement is, the lower the Shading Rate needs to be set in the Render Options Editor to pick out those intricacies. This is also true in sharpening the effects of a Displacement Shader. The more micropolygons, the sharper the focus. In the above example, the Shading Rate is set to 0.25, which substantially increases the rendering time. This needs to be kept in mind when developing Displacement Shaders.