Metamorphic rocks: Formed by the temperature and pressure changes inside the Earth. Sedimentary rocks: Formed from the products of weathering by cementation or precipitation on the Earth's surface. Igneous rock: Formed by the cooling of magma (molten rock) inside the Earth or on the surface.