What is the algorithm used to create terrain cells?

I would like to create my own implementation of Roblox’s terrain constructed using triangle meshes, but I do not know how individual cells are created and merged together.

In the docs for terrain, it is said that
“Terrain lets you create dynamically morphable environments with little to no lag. It is currently based on a 4×4×4 grid of cells, where each cell has a number between 0 and 1 representing how much the geometry should occupy the cell, and the material of the cell. The occupancy determines how the cell will morph together with surrounding cells, and the result is the illusion of having no grid constraint.”

How is one of these cells generated based on the provided number? I would like to mimic that same functionality in my own terrain system.

this playlist might help you