Choose an image with element at different distances that are easily separated . In this image, the three elements are the sky, the ground, and the wall.Original Image
The original image will serve as the view for one eye; a copy of the image with the elements shifted will be the other. The closer an object is, the further it must be shifted. The sky is at infinity, so it doesn't have to be shifted at all. The wall is very close, so it has to be shifted a lot. The direction of shift depends on whether the final image is to be viewed cross-eyed or infinity focus. (Note that you can also change the viewing method by swapping the left and right panels of the finished product.)Depth Mask
We could simply shift the ground, but the entire thing would appear to be at the same distance. Instead, create a depth mask mask, clipped to the layer, with the value indicating depth. In this case, the change in depth is related (almost) linearly with height, so I used a gradient. Save this as a separate file. Use the Displace filter (found under Filters->Distort) on the layer you wish to distort. Selecting the proper combination of parameters and gradient may require some trial-and-error. Click "ok" and select your mask.