What's the right way of generating a procedural mesh from an known outline?

I want to generate a procedural terrain in a 2D game, and I’m thinking that this can be achieved with a meshFilter component. Think worms, scorched earth, desert golfing, etc.

I’m not interested in generating the shape of the level in itself, but generating the mesh (vertices and triangles) from an already existing and known outline for the terrain, as a set of coordinates. Either if there is a builtin way of doing this or some pointers to existing algorithms to achieve what I want.

Maybe a mesh is not the right way, I’d like to hear what’s a better way of achieving this in that case.

There are plenty of examples of procedural mesh generation; try this for starters: Procedural Examples | Tutorial Projects | Unity Asset Store

@kkxzd You could use Constrained Delaunay triangulation to create the optimal triangle net, and then loop through the triangles to remove the ones that should not be filled.