This page deals with the fundamentals of why molecules absorb radiation selectively
This diagram shows two energy levels in a molecule; that is how energies are in molecules, they are quantized, they are not continuous in other words. Whether the transition from level 0 to level 1 refers to an electronic change, a vibrational change or a rotational change, the condition for the change occurring by the absorption of a photon of radiation is that given by the equation in the diagram. The photon with just the correct energy to cause the excitation is that shown in green. The blue photon has too much energy to cause the transition and the red one does not have enough energy. This is why molecules absorb selectively; their energy levels are quantized.
Solids and liquids can also exhibit selectivity in their interactions with radiation; we live in a colourful world. At temperatures on the Earth's surface solids and liquids emit radiation in the infrared region that is non-selective and is governed more by the ambient temperature than by their quantized energy levels. This is because when molecules and atoms are in close proximity they interact in such a way as to remove the effects of quantization; their energy levels are almost continuous and they behave as black bodies or cavity radiators, such as a heated oven is. The Earth's surface emits infrared radiation that approximates to that of a black body. The emissivity of a black body is 1, that of the Earth's surface is about 0.95. When the emissivity deviates from unity the Stefan-Boltzmann equation is modified to:
E = esT4