I did it on this picture of a butterfly. I took a few pictures... when I got home I had one with the head in focus, the other with the wings in focus. I did it manually with layers in Photoshop though, didn't know there was software for it.
Focus stacking can indeed be done manually using layers and layermasks - however this approach can take a very long time, especailly to do properly. Further more using software approaches one can use the stacked shots to both improve the overall sharpnes and reduce nosie present in the shot - often when I get a (working) stacked shot its far less noisy and far sharper than anything else I can produce with my setup.
Software though does have its limits as Ron points out so its not a totally safe bet that a series of shots will work. This is why most who use this process will also grab a quick single shot exposure to record the sight incase the stacking fails.
With a working image stack from software you can get results like this
There are more details about each stack on the respective flickr pages linked above. The software I now use is Combine ZP which is free to download and use.
Errors can come in all forms and sometimes be totaly baffling as to the cause - eg below
However most of the the cause is that you have a frame that is out of sequence or a missing frame. It is key to ensure that when you take the shots you take each shot one after the other with the focus moving into the scene (or out of, though the former is easier for many). You should also ensure that there is overlap between each frame so that the software can match up the different segments.
Below is a common problem where one frame is missing from the end shot and you get a strange duel focused shot
How do you manually stack them in layers? Just use masks and paint in the focus? I know Photoshop has an auto stack feature in the extended version, but I don't have that one. I really like those bug pics overread
thanks
And yes it is just a case of painting in the infocus parts of the shot using masks - however this can be very time consuming and tricky when you have more complext images. I have done the odd flower in the past and it was very easy to end up missing out small areas of detail. A free software approach is to download and use Combine ZP - there are some others on the market as well that do similar process and yes full photoshop also has a stacking feature.