I remember seeing a similar question to this one on Physics StackExchange once. Most of the answers were to the effect of "I don't like the way this question is phrased, so I will insult your intelligence and not answer". I describe the question in a way that I think is possibly too explict specifically to prevent these counter-productive answers.
Consider the following scenario: there is a magic photon source that emits photons in both directions along a single axis. In one direction is an infinite amount of lead, in the other direction is an infinite amount of osmium. The emitted photons pass directly into these metals and do not interact with anything else, nor are any other forms of radiation present. The energies of these photons range from high ultraviolet to the most energetic gamma ray known to be possible, with every amount of energy being equally represented. The photons are emitted at sufficient intervals that any increase in temperature caused by a photon will dissipate before the next photon is emitted (though the base temperature is unspecified).
In this situation, will the photons, and any secondary energized particles, travel farther through the lead or the osmium?
The description of high-energy photon flux attenuation that I am familiar with says that a high-energy photon passing through conventional matter will lose energy by interaction with atomic nuclei that it passes, with more massive nuclei reducing the photon's energy by a greater amount. Thus lead, being the stable element with the highest atomic number, seems like an obvious choice for shielding against this type of radiation. The question arises because osmium has a close atomic number to lead but is much denser, meaning that a photon will interact with more atomic nuclei in the same distance. In a purely hypothetical sense, this might make osmium a superior shield.
Additionally, if any element or compound will stop these photons more effectively than either lead or osmium, I would like to know about that.