Planets with sizes between those of Earth and Neptune divide into two populations: purely rocky bodies whose atmospheres contribute negligibly to their sizes, and larger gas-enveloped planets possessing voluminous and optically thick atmospheres. We show that whether a planet forms rocky or gas-enveloped depends on the solid surface density of its parent disk. Assembly times for rocky cores are sensitive to disk solid surface density. Lower surface densities spawn smaller planetary embryos; to assemble a core of given mass, smaller embryos require more mergers between bodies farther apart and therefore exponentially longer formation times. Gas accretion simulations yield a rule of thumb that a rocky core must be at least 2$M_oplus$ before it can acquire a volumetrically significant atmosphere from its parent nebula. In disks of low solid surface density, cores of such mass appear only after the gas disk has dissipated, and so remain purely rocky. Higher surface density disks breed massive cores more quickly, within the gas disk lifetime, and so produce gas-enveloped planets. We test model predictions against observations, using planet radius as an observational proxy for gas-to-rock content and host star metallicity as a proxy for disk solid surface density. Theory can explain the observation that metal-rich stars host predominantly gas-enveloped planets.