The basic element for the deformation is the vector queried from the displacement map. This vector usually holds
either a RGBA-color or a scalar color (gray level height map). We will use this vector and more precisely the sum of its components as a factor to change the vertex position.
One of the common methods is to move the vertex position along its normal proportionately to the previous factor.

Fig. 3 - Displacement principleThe schema of the figure 3 can be summed up by the following relation:

P1 = P0 + (N * df * uf)

where **P0** is the original position of the vertex, **P1** the vertex position after displacement, **N** the
vertex normal vector, **df** the normalized displacement factor (i.e [0.0; 1.0]) and **uf** an user scaling factor.
**df** can be get with the following relation which converts a RGB value to a grey value:

df = 0.30*dv.x + 0.59*dv.y + 0.11*dv.z

where **dv** is the vector fetched from the displacement map for the current processed vertex.

Now that the theory is okay, let's go to the practice...