3D films existed far long before the production of Star Wars, Lord of the ring or even Avatar.
3D have been used in films since 1915, unfortunately, the films were costly to produce and largely relegated to a niche of audience.
3D (three-dimensional) film is a motion picture that enhances the illusion of depth perception.
The most common approach to the production of 3D films is derived from stereoscopic photography. Stereoscopic photography is a technique for creating or enhancing the illusion of depth in an image for binocular vision.
Basically 3D effects is achieved by manipulation of vision and perspective.
Avatar is made up of about 60% computer generated elements and only 40% live action and traditional miniatures. During the shoot virtual camera system where used so the director and his crew could get an approximation of how things would look like with the computer generated imagery added in.