public static RenderGeometry CreateSphereGeometry(float radius, int segmentP, int segmentH, bool smoothH, bool smoothV, float cutTop = 0, float cutBottom = 0)
    {
        if (cutTop + cutBottom > 1)
        {
            return(new RenderGeometry());
        }

        RenderGeometry.FaceType  faceType = GetFaceType(smoothH, smoothV);
        StructureGeometry        structure = new StructureGeometry();
        SurfaceComponentGeometry upperPart, lowerPart, middlePart;

        if (cutTop != 0)
        {
            upperPart = SurfaceComponentGeometries.CreateRegularPolygonGeometry(radius * Mathf.Sqrt(4 * cutTop * (1 - cutTop)), segmentP, 2);
            upperPart.ApplyOffset(radius * (1 - 2 * cutTop) * Vector3.up);
        }
        else
        {
            float angle = cutBottom != 0 ? Mathf.Acos(-1 + cutBottom * 2) : Mathf.PI * (segmentH / 2) / segmentH;
            upperPart = SurfaceComponentGeometries.CreateSphereCapGeometry(radius, segmentP, cutBottom != 0 ? segmentH : segmentH / 2, 2 * angle, 0, 1, faceType);
        }
        if (cutBottom != 0)
        {
            lowerPart = SurfaceComponentGeometries.CreateRegularPolygonGeometry(radius * Mathf.Sqrt(4 * cutBottom * (1 - cutBottom)), segmentP, 2);
            lowerPart.ApplyOffset(radius * (1 - 2 * cutBottom) * Vector3.up);
            lowerPart.ApplyRotation(Quaternion.AngleAxis(180, Vector3.right));
        }
        else
        {
            float angle = cutTop != 0 ? Mathf.Acos(-1 + cutTop * 2) : Mathf.PI * ((segmentH + 1) / 2) / segmentH;
            lowerPart = SurfaceComponentGeometries.CreateSphereCapGeometry(radius, segmentP, cutTop != 0 ? segmentH : (segmentH + 1) / 2, 2 * angle, 0, 1, faceType);
            lowerPart.ApplyRotation(Quaternion.AngleAxis(180, Vector3.right));
        }
        if (cutTop != 0 && cutBottom != 0)
        {
            float angle1 = Mathf.Acos(1 - cutTop * 2);
            float angle2 = Mathf.Acos(-1 + cutBottom * 2);
            middlePart = SurfaceComponentGeometries.CreateSphereSideGeometry(radius, angle1, angle2, segmentP, segmentH, 0, 1, faceType);

            Vertex cornerUp   = structure.CreateVertex();
            Vertex cornerDown = structure.CreateVertex();
            structure.CreateFace(middlePart, false, cornerUp, cornerUp, cornerDown, cornerDown);
            structure.CreateFace(upperPart, false, cornerUp);
            structure.CreateFace(lowerPart, false, cornerDown);
        }
        else
        {
            Vertex corner = structure.CreateVertex();
            structure.CreateFace(upperPart, false, corner);
            structure.CreateFace(lowerPart, false, corner);
        }
        return(structure.Build());
    }