The cylindrical nanoscale density variations resulting from the interaction of 185 MeV and 2.2 GeV Au ions with 1.0 μm thick amorphous SiN :H and SiO :H layers are determined using small angle x-ray scattering measurements. The resulting density profiles resembles an under-dense core surrounded by an over-dense shell with a smooth transition between the two regions, consistent with molecular-dynamics simulations. For amorphous SiN :H, the density variations show a radius of 4.2 nm with a relative density change three times larger than the value determined for amorphous SiO :H, with a radius of 5.5 nm. Complementary infrared spectroscopy measurements exhibit a damage cross-section comparable to the core dimensions. The morphology of the density variations results from freezing in the local viscous flow arising from the non-uniform temperature profile in the radial direction of the ion path. The concomitant drop in viscosity mediated by the thermal conductivity appears to be the main driving force rather than the presence of a density anomaly.