When a target atom is struck by some kind of radiation (for example, a $\text{MeV}$ proton), electrons from lower shells are kicked off and replaced by electrons from higher shells, which in return emit electromagnetic radiation (photons). Energies of photons emitted during these transitions are specific for every element and they can help us identify elemental composition of the target. Energies corresponding to certain transitions ($\text{K}\alpha$, $\text{K}\beta$, $\text{L}\alpha$, $\text{L}\beta$ lines, etc.) can be found in this table, and they are (mostly) from the X-ray part of the spectrum.
As for luminescence, from what I read, it also takes place during transitions of electrons between shells. But, if energy gaps are the same, I can't understand how can energy ever be emitted in the visible part of the spectrum. I am obviously missing something here. Maybe luminescence occurs only for crystalline structures, but can never happen for one atom alone?
So, to sum up: When does luminescence occur? Why and when are electrons transitions followed by emission of photons in visible part of the spectrum instead of X-ray? Some examples could also be helpful. Thanks!