How terrain editor smooth tool working?

Hello. I want try to recreate Roblox studio default Terrain Editor. I made ALL “Edit” tools from it myself, with medium improvements. But for now, I stuck with smooth tool, bc I haven’t any ideas to how calculate voxel filling to make it look smooth.
Does someone here can help me, and say me any ideas of Smooth tool behaviour?

It makes terrain smooth based off lerping

Hm… After anothr 5 hours of research with lerping, I got nothing. How it detect when smth is smoothed, and when - not???

Sorry, but I’m bumping this topic, bc after 3 weeks I still haven’t any ideas about how to make smooth tool.