Backport changes from demo (metaballs).