  Cold gas in galaxies provides a crucial test to evaluate the realism of
cosmological hydrodynamical simulations. To extract the atomic and molecular
hydrogen properties of the simulated galaxy population, postprocessing methods
taking the local UV field into account are required. We improve upon previous
studies by calculating realistic UV fields with the dust radiative transfer
code SKIRT to model the atomic-to-molecular transition in TNG50, the
highest-resolution run of the IllustrisTNG suite. Comparing integrated
quantities such as the HI mass function, we study to what detail the UV field
needs to be modelled in order to calculate realistic cold gas properties. We
then evaluate new, spatially resolved comparisons for cold gas in galaxies by
exploring synthetic maps of atomic hydrogen at redshift zero and compare them
to 21-cm observations of local galaxies from the WHISP survey. In terms of
non-parametric morphologies, we find that TNG50 HI maps are less concentrated
than their WHISP counterparts (median $\Delta C\approx0.3$), due in part to
central HI deficits related to the ejective character of supermassive black
hole feedback in TNG. In terms of the HI column density distribution function,
we find discrepancies between WHISP and IllustrisTNG that depend on the total
HI abundance in these datasets as well as the postprocessing method. To fully
exploit the synergy between cosmological simulations and upcoming deep HI/H2
data, we advocate the use of accurate methods to estimate the UV radiation
field and to generate mock maps.
