Read Ogre3D forum showcase :

It has a topic on that and dicuss different techniques to do it, some fats , some slow.

Don't waste time digging how to do it , when other people have already done it