The distinction between terrestrial and gas giant planets originates from the temperature gradient present in the protoplanetary disk. Closer to the Sun, higher temperatures allowed only metals and rocks to condense, forming terrestrial planets. Farther from the Sun, cooler temperatures allowed ices and gases to condense, forming gas giants.