Insulating with open-cell spray foam under the roof deck is an excellent choice when the HVAC ducts run through the attic. Spray foam is most commonly applied in the space between the attic rafters. It seals all of the air-leakage gaps and spaces, and provides very high R-value in one step. The result will be a conditioned attic space. This means, in the summer, cooled air traveling through the ducts will no longer be warmed by hot attic air, and heated air will no longer be lost in the winter on its way to the rooms.