We can perform displacement mapping just as easily as we do bump mapping. We simply copy our "bump mapping" code to the vertex shader, and in addition to changing the normal we also move the vertices along the old normal direction.
To make things a little more interesting, we perform both a displacement mapping in the vertex shader and a bump mapping in the fragment shader. The displacement is performed at a fairly coarse scale, and the bump mapping adds finer detail. In a real application, the level of detail should decide how the shaders divide the scales between them, but let's keep it reasonably simple.
Now, these shaders are not trivial, but they are quite simple compared to what would have been needed to compute correct normals if we had used 2-D textures for doing both the displacement mapping in the vertex shader and the bump mapping in the fragment shader. Note that we perform no preprocessing at all, this is just procedural displacement functions computed on the fly.
Contrary to the "fake bump mapping" we showed in the 2-D tutorial, this is how you do proper displacement and bump mapping with 3-D textures. Despite its brevity, this code is not a shameful quick hack.
// Fragment shader code goes here
// Vertex shader code goes here