The formation of gas giants, such as Jupiter and Saturn, involves a different mechanism. Once a protoplanet reaches a certain mass, its gravitational pull can attract and retain a significant amount of the surrounding gas from the protoplanetary disk. This runaway gas accretion leads to the formation of massive gas envelopes around a solid core.