Effects of megascale eruptions on Earth and Mars