In the core accretion model , gas-giant planets first form a solid core , which then accretes gas from a protoplanetary disk when the core exceeds a critical mass . Here , we model the atmosphere of a core that grows by accreting ice-rich pebbles . The ice fraction of pebbles evaporates in warm regions of the atmosphere , saturating it with water vapor . Excess water precipitates to lower altitudes . Beneath an outer radiative region , the atmosphere is convective , following a moist adiabat in saturated regions due to water condensation and precipitation . Atmospheric mass , density and temperature increase with core mass . For nominal model parameters , planets with core masses ( ice + rock ) between 0.08 and 0.16 Earth masses have surface temperatures between 273 K and 647 K and form an ocean . In more massive planets , water exists as a super-critical convecting fluid mixed with gas from the disk . Typically , the core mass reaches a maximum ( the critical mass ) as a function of the total mass when the core is 2-5 Earth masses . The critical mass depends in a complicated way on pebble size , mass flux , and dust opacity due to the occasional appearance of multiple core-mass maxima . The core mass for an atmosphere of 50 percent hydrogen and helium may be a more robust indicator of the onset of gas accretion . This mass is typically 1-3 Earth masses for pebbles that are 50 percent ice by mass , increasing with opacity and pebble flux , and decreasing with pebble ice/rock ratio .