Compiz? Emerald? Metacity? What's the Difference?

Not for the first time, I found myself the other night explaining on IRC how the window manager and window decorator parts fit together. There seems to be a misconception that Compiz requires Emerald. That is far from true. There also seems to be confusion regarding what different kinds of themes do. So let's start at the basics.

The three most common window managers in the Ubuntu world are Metacity, Compiz, and Kwin. Yes, there are others, such as Enlightenment, Fluxbox, Xmonad, and Ion, but I'm not going to go into why each of them rocks. Metacity is the default GNOME window manager. Kwin is the KDE window manager. And then there's Compiz. Compiz is the compositing window manager that is enabled in Ubuntu by default if your system can handle it. The function of the window manager is to draw the windows in a certain place, with a certain size, and let them be movable and resizable.

Then you have the window decorator. This is where people get tripped up.