Almost all the energy in ecosystems comes from the sun.Energy is captured by producers and then passed in a linear progression from one trophic level to the next. At each level, much of the energy escapes the ecosystem as heat. Unlike this one-way flow of energy, matter is recycled within and between ecosystems. Elements pass from one organism to another and among parts of the non-living environment through closed loops called biogeochemical cycles.