Exactly. If you really want to get into it the depth of the construction of the panels you need is based on some maths - density of the insulation material and it's particular properties but all of that can be found out on forums such as this one:
https://gearspace.com/board/studio-building-acoustics/ - vs the frequencies you wish to treat.
You can put your room dimensions into a calculator and get a rough idea of some of the try and find the modes of the room - which you want to treat, though sometimes it takes trial and error as well. But you want to treat the point of first reflection and then have bass trapping in the corners.
Don't buy that "acoustic foam" that looks like egg cartons, it's rubbish.