When transforming thermal energy into mechanical energy , the thermal efficiency of a heat engine is the percentage of energy that is transformed into work . The thermal efficiency of a heat engine is the percentage of heat energy that is transformed into work .