Mike,
DIY spray foam kits are costly but invaluable for irregular surfaces. I followed this guy's recommendation for my retrofit and I'm happy with results and it was much cheaper than spray foam, but is only good for consistent, open areas that you can fit cut boards into (i.e. not crazy irregular surfaces and spaces).
https://www.youtube.com/watch?v=i1guAwzyEOQ
Regards,
Theodore.
P.S. for roofs, don't forget to consider leaving an air gap if you have functional soffit and ridge vents!