In the Solar System giant planets come in two flavours: 'gas giants' (Jupiter
and Saturn) with massive gas envelopes and 'ice giants' (Uranus and Neptune)
with much thinner envelopes around their cores. It is poorly understood how
these two classes of planets formed. High solid accretion rates, necessary to
form the cores of giant planets within the life-time of protoplanetary discs,
heat the envelope and prevent rapid gas contraction onto the core, unless
accretion is halted. We find that, in fact, accretion of pebbles (~ cm-sized
particles) is self-limiting: when a core becomes massive enough it carves a gap
in the pebble disc. This halt in pebble accretion subsequently triggers the
rapid collapse of the super-critical gas envelope. As opposed to gas giants,
ice giants do not reach this threshold mass and can only bind low-mass
envelopes that are highly enriched by water vapour from sublimated icy pebbles.
This offers an explanation for the compositional difference between gas giants
and ice giants in the Solar System. Furthermore, as opposed to
planetesimal-driven accretion scenarios, our model allows core formation and
envelope attraction within disc life-times, provided that solids in
protoplanetary discs are predominantly in pebbles. Our results imply that the
outer regions of planetary systems, where the mass required to halt pebble
accretion is large, are dominated by ice giants and that gas-giant exoplanets
in wide orbits are enriched by more than 50 Earth masses of solids.Comment: Accepted for publication in Astronomy and Astrophysic