There are a few broad approaches to generating a tesselated, spherical surface mesh. Here a couple of the more common ones...
Construct a cube with densely-subdivided planes, then expand those planes outward into a spherical form: this is simple enough -- for each surface point, calculate a vector from the origin (centre of cube) to that point, normalize the vector such that the point is at distance one from the origin, then multiply the position vector by your desire planetary radius. The nice thing about this approach is that triangulation is extremely simple, because you simply subdivide each plane of the cube as though it were a grid, and then split into two triangles per grid cell (you'll have seen this many times before).
Construct some set number of points at the planet's origin (core), and push them out to some distance using randomly-rotated quaternions; the distribution over the sphere surface can then be evened out using physical methods; think of how a fibre-optic lamp's fibres spread out fairly evenly over some space, because of physics:
Gravity creates a similar effect here, to what would occur if each fibre-tip repelled the other as though with atomic forces, which is exactly the approach you could apply to create a more even distribution (related to the concept of Lloyd Relaxation, which can also be applied in three dimensions). Once you have these points, you can use something like Delaunay Triangulation (or any other triangulation algorithm you wish) to triangulate the points into a fully-connected mesh.
If you are constructing a voxel-based world...
- 3D cells / voxels provide a simplistic, if brute-force / less performant option. The viability of this approach depends very much on your planetary radius and desired surface resolution, and whether or not you use accelerative, spatial subdivision structures like octrees or KD-trees. Basically, create a cubic voxel volume with a diameter equalling that of your desired planetary body. For every voxel (likely to be in the millions if not billions or trillions), perform a distance check from the centre of the world (i.e. centre of the cubic volume), and if the distance is greater than your desired planetary radius, remove that voxel from the grid. Clearly, this is an
O(n^3) operation involving multiple square root operations per 3D-vector radial magnitude check, meaning it will be very costly indeed even for a world diameter of 1000 voxels (10^9 checks). However, this may be acceptable for worlds which are generated in their entirety before play commences.