More massive stars follow a different evolutionary path. After the red supergiant phase, they can undergo a catastrophic explosion known as a supernova. This occurs when the core collapses under gravity, leading to a rebound shockwave that expels the outer layers. Supernovae are incredibly luminous and play a crucial role in disseminating heavy elements throughout the galaxy.