Luminescence of molecules and crystals