Sedimentary rocks are formed on or near the Earth's surface, in contrast to metamorphic and igneous rocks, which are formed deep within the Earth. ... Erosion and weathering transform boulders and even mountains into sediments, such as sand or mud. Dissolution is a form of weathering—chemical weathering.