Basic Cycles Cavity shader tutorial.
This walk-through is thorough and detailed in its explanation and only assumes only basic knowledge of interface manipulation.
Firstly you need to insure that your mesh is high-poly enough because we will be using Vertex Colors. The monkey mesh shown about is NOT high-poly enough and will show streaking in the final result if not subdivided.
Add a sub-div modifier and apply it if you think it’s needed.
Hop on over to the Vertex Painting mode.
In the Paint menu in the footer, select “Dirt Vertex Colors.”
This is the result of the bake with the default settings:
Directly after giving the AO bake command, press F6 to open the settings for this command;
Enter a smaller value for the Highlight Angle field to make the exposed areas stay white, and the cavities become darker.
This makes the overall result too bright, so you need to repeat these steps several times (I had to do it ~5 times)
 To clarify, you need to rebake, and change that setting for each time to repeat the process. Simply pressing F6 several times won’t change anything.
Keep in mind that once we are finished with this shader, Pure White will only be our one shader while Pure Black will be only the secondary shader.
This looks much better:
Now for the fun Part:
Add a new material, and change the surface type of Mix Shader:
Change the two mixed shaders to Glossy and Diffuse (in that order)
Now split a new node window making sure that you are seeing material nodes.
Change the shader colors to suit your needs. Here I set the Base glossy color to a brassy color, and the cavity shader to a bronze patina color (with exaggerated saturation).
Add a new attribute node:
Quickly pop open the Object Data tab:
Copy the Vertex Color name.
Paste the copied vCol name into the attribute node:
Plug in a a color invert node:
This is what everything should now look like. Notice the attribute’s output is plugged into the Col value of the invert. By default it’ll go into the Factor value which is something totally different.
Upon render, your shader could look something like this:
There several things you could do differently. For example, you might have used different settings at the AO bake stage. You might have tweaked the baked vertex colors manually with the paint brush getting ‘custom’ results.
The shader is as basic as you can get it. You could modify this to your heart’s content to get exactly the results you want.
Check out the .Blend file if you have trouble following the tutorial: