Infinite Resolution Spherical Terrain

A planet viewed from orbit and the same planet explored on foot require very different amounts of geometric detail. Generating the entire surface at walking-scale resolution would spend most of the computation and memory on terrain the viewer cannot see.
Planet Architect addresses this through adaptive subdivision. The surface has no single fixed mesh resolution: finer chunks are generated as the viewer approaches them. The implementation remains bounded only by floating-point precision, although a multiple-coordinate-system approach is planned for the future which would bypass even this.
Turning a cube into a planet
The terrain begins as six square grids, one for each face of a cube. Each face in its entirety is the root chunk for that direction, consisting of a 64x64 grid of points. Each grid point is projected radially onto a sphere.
For a face with normal n and tangent basis vectors u, v, a point with face coordinates (a,b) maps to:

Once the spherical position of the point found, the terrain system can further modify its position radially.
This construction gives each face a regular two-dimensional coordinate system while producing a continuous spherical domain for terrain sampling. The projection introduces area distortion, but the regular grid makes subdivision and indexing straightforward.
Each face owns a quadtree. Recursively, each chunk can be split into four children of smaller size but the same dimensions, leading to double the resolution. However, if every face was uniformly subdivided to depth L, that level would contain 6 * 4^L chunks. Instead, I selectively subdivide only the chunks close to the player character.

Subdivision without temporary holes
When a player moves across a chunk border, each currently active chunk gets checked for subdivision or merging based on the distance from the player. The distance is calculated as a ratio of the chunk's size, so smaller chunks need to be very close to the player to be further subdivided. Once a chunk's subdivision is ordered, the generation of the four children chunks starts in the background. Only once all four children finish generating is the parent chunk disabled and replaced with the children. This ensures that there is no holes in the terrain while the chunks are being generated, since the generation happens in a separate thread to prevent frame drops.
Reusing work between resolutions
Planet Architect uses a 3/4 optimization by cleverly structuring the children chunks. Each child is positioned such that one quarter of its points coincides exactly with the points of the parent chunk, and the remaining 3/4 fill in the gaps between. The parent's points can therefore be reused, skipping all further simulation steps. This way we only ever have to calculate 3/4 of the points for any given chunk beyond level zero.
Fixing Seams
Lighting continuity. Matching border vertices are identified using quantized positions. Their normals are reconstructed from cached base normals across neighboring chunks, reducing lighting discontinuities at matching boundaries.
Mixed-resolution geometry. Adjacent chunks may have different edge tessellations. Finer chunks include radially-inward-facing skirts that help cover the resulting gaps.
Material continuity. Every skirt vertex stores the index of its source surface vertex. Biome weights and auxiliary vertex data are copied through that mapping, so the extra geometry receives the same environmental information as the surface it extends.
Horizon Culling
Since Planet Architect's planets are all spherical, many of the chunks which would be created with the quadtree system would be invisible to the player due to the planet's curvature. Hence, to prevent wasted work, Planet Architect first checks whether each chunk could theoretically be visible to the player. Using the parent's points which have already been calculated, we find the tallest point of the chunk. then using a line-sphere intersection test on the line connecting that point to the player camera, we check whether the entire chunk is below the horizon. If it is, we disable it and do not perform the subdivision. This way, far away chunks are only rendered and simulated if they have very tall peaks.





