When you paint with brushes that have the Depth setting turned on as an option (see Depth in Channels brush settings, part of Paint Effects Brush Settings), or the Force Depth override turned on (see Force Depth in the Scene section of Paint Effects Globals Options), Paint Effects records the distance of the paint from the camera in the depth channel (or Zdepth or Zbuffer channel). You can save the depth values as grayscales for later use (for example, as a bumpmap).
To save depth as grayscale values