How do 3D glasses work?

A visit to the toilet is included in Professor Phil Moriarty's explanation of 3D glasses. How do 3D films give us that three dimensional effect?