The two factors that affect thermal energy are