Algorithm for blending/merging shapes together like liquid
The Povray raytracer has an object like this, the blob. You find its code with some explanations at https://github.com/POV-Ray/povray/blob/master/source/core/shape/blob.cpp .