Orodruin said:
This is where your misconception lies. Thermal radiation is not due to energy transitions in atoms or molecules.
This is a very misleading statement. Of course, radiation in thermal equilibrium is due to the quantized emission and absorption of radiation energy (aka photons). Equilibrium occurs due to this continuous absorption and emission processes due to the principle of detailed balance, i.e., it is a state of maximum entropy and thus described by the Bose-Einstein distribution for photons. The mean photon number is determined completely by temperature.
In a cavity the black-body spectrum is in principle discrete, because the possible wave modes are quantized due to the boundary conditions for the electromagnetic field in the cavity, however the possible frequencies are dense since the possible photon momenta are separted by about ##2 \pi \hbar/L##, where ##L## is a typical extension of the cavity, and this is a very small number. So you can usually take the thermodynamic limit (formally volume to infinity keeping the photon density constant). In this limit the black-body spectrum becomes continuous. The ensity of states is ##\mathrm{d}^3 \vec{k}/(2 \pi \hbar)^3## and thus the mean density of photons at temperature ##T#
$$\langle N \rangle=2 \int_{\mathbb{R}^3}} \mathrm{d}^3 \vec{k} \frac{1}{(2 \pi \hbar)^3} \frac{1}{\exp(c |\vec{k}|/k_B T)-1},$$
where the factor 2 comes from the two polarization states for each photon mode.
The best black-body spectrum in Nature is the cosmic microwave background in the universe. Here the details are a bit different. Here there was thermal equilibrium between ions and radiation up to a time about 400000 years after the big bang. Then the same mechanism as described above for the cavity black-body radiation was at work: The photons (i.e., quantized radiation energy) was absorbed and emitted all the time by collisions among the photons with the ions and among the atoms. Due to the principle of detailed balance (which is, btw, following from the unitarity of the S matrix and thus a very fundamental principle) you have radiation and ions in thermal equilibrium as long as the emission and absorption rates are small compared to the expansion rate of the universe. Thus, at some time when the universe cooled down to the Mott transition temperature, where the ions (i.e., electrons and protons, and the light primordial nuclei) combine (funnily one talks about "recombination" although there were no atoms before this time of the universe's evolution) to electrically neutral atoms, the emission and absorption rates went down drastically (practically to 0). From this moment on the photons were decoupled from the heatbath ("freeze-out"). Now photons are massless and thus there is no intrinsic scale in the black-body spectrum (the only intrinsic energy scale is the temperature of the universe). Thus the only thing happening to the photons is gravitational redshift multiplying all photon momenta and frequencies by a common red-shift factor. Thus the CMBR looks still like a black-body spectrum but with a much smaller temperature by the same redshift factor as the photon frequencies. This becomes also clear quantitatively: The Mott-transition temperature is around 3000K and the red-shift factor from the time of "recombination" is around 1000, giving about 3K for the background radiation, which is not bad compared to the very precise value (around 2.75 K) from COBE, WMAP an PLANCK.