As position based simulation techniques are very fast theses days, it is possible to use them to conform intersecting spheres to each other, to model foam. Nevertheless there are other possibilities, too. In this tutorial, Manuel shows you how to come up with an analytical operator that removes the intersections from a dense sphere packing by deforming the intersecting points. This is even faster than PBD and can be used without any simulation at all. The video deals with implementing the setup. The particle effect from the demo is included in the hip file though.