The greenhouse effect works much the same way on Earth. Gases in the atmosphere, such as carbon dioxide, trap heat just like the glass roof of a greenhouse. These heat-trapping gases are called greenhouse gases. ... But some of the heat is trapped by the greenhouse gases in the atmosphere.