How to change crater floor from convex to concave?

Hi ive deformed a sphere to make a crater, however the bottom of the crater is not bowl shaped but rather convex and i dont know hot to fix it. here is my code for making it :slight_smile:

    public void sphereDeformer(Vector3[] verts, Vector3 impactCenter, float impactRadius, float deformationStrength)
    {
      

        var sqrRadius = impactRadius * impactRadius;

        for (int i = 0; i < verts.Length; i++)
        {
            var v = verts[i];
            var diff = v - impactCenter;
            var sqrDist = Vector3.Dot(diff, diff);

            if (sqrDist <= sqrRadius)
            {
                // Use the surface normal to deform the vertex
                v += deformationStrength * -normals[i];
            }

            verts[i] = v;
        }

        // Initialize the deformed mesh with the same number of vertices and triangles as the original mesh
        deformedMesh.Clear();
        deformedMesh.vertices = verts;
        deformedMesh.triangles = originalMesh.triangles; 

        // Assign the deformed mesh to the MeshFilter component
        GetComponent<MeshFilter>().mesh = deformedMesh;
    }

A sphere surface is by definition convex.

If you want to re-wind the triangles as facing the opposite way then it could be concave.

Wherever you add (a,b,c) as triangle indices, instead add (a,c,b)

You’re welcome to see all kinds of procgen examples in my MakeGeo project.

MakeGeo is presently hosted at these locations:

https://bitbucket.org/kurtdekker/makegeo