Spatial Variation of Planetary Terrain

Published January 14, 2024
Advertisement

I've been working a lot the last month on making the planetary terrain generation more easily parameterizable with spatially-varying data. By adding more variation the hope is to avoid the "No Man's Sky effect" where planets are the same everywhere on the surface.

The variations include:

  • Base low-frequency elevation (continents without small-scale details)
  • Noise spectral variation - controls the amplitude of each spatial frequency in the noise in particular location, and also the "crossover scale" where the noise is high-pass filtered, which determines the scale of mountains.
  • Noise density variation - controls how dense the noise is for each spatial frequency in a location. A lower density produces isolated mountains.
  • Noise transform variation - mathematical transformations are applied to the noise to produce different shapes of terrain. At any given location, the terrain is a weighted sum of the transforms that are active. By varying the weights, the terrain can be different across the planet surface.
  • Material variation - the materials present in a location are sampled from a spatially-varying probability distribution. There are multiple material layers, each sampled from the distribution. The probabilities will be controlled by the composition of the planet as it varies over the surface (e.g. more ices at poles). The trick here is to use discrete noise (not interpolated) to sample, to avoid banding artifacts when sampling the CDF.

This variation capability depends on being able to efficiently and smoothly interpolate parameters across the planet surface. To do this, I introduced a "sparse" data format that is suited for low-frequency data. Instead of storing 99x99 values in a terrain tile, it only stores 4x4 and interpolates the data to full resolution when needed. This reduces the memory required by a factor of 612. Without it, the above variations would not be practical (requiring a few GB of memory).

The main downside of this sparse format is that it is too smooth - the resolution is low (65x65 per cube face), which results in 154km per pixel. This is not that great because it means that any variation is only noticeable from orbit, in any given location at surface level you see mostly the same things. There's not any good solution for this aside from paying more memory, or maybe doing a non-interpolating interpolation to preserve hard edges (but not sure if that is possible).

Current results:

Somehow the SSR actually worked here
Sun is yellow/orange due to attenuation through atmosphere
Preliminary results for craters generated using low-density noise
3 likes 2 comments

Comments

JoeJ

The main downside of this sparse format is that it is too smooth

I have the same problem, but did not try to solve it yet.

Likely we want to upscale the data in some way so high frequency details emerge. But not sure how to do this while still providing good art control.

If i want hard edges instead smooth gradients, the first thing coming to mind is some voronoi cells noise.
But since cells are usually of similar size, results are too boring and regular for my needs.
So i tend to get this from fluid simulation instead.
I recently tried it again, but this time using the much simpler basic Joe Stam method in 2D. It works:

The image shows fluid density. I got this by giving the gradient result of the pressure solver the wrong sign and some scale, iirc.

Displacing this, and adding divergence of the velocity field (iirc), i even get effects similar to signed distance from cell boundaries, without actually computing that:

The initial state i have used here is this noise:

I think, using some real world image, i can get smaller cells in dark areas and larger cells in bright areas. The initial image should still be visible, but facetted and quantized in some interesting way.
Maybe much easier than by using conventional methods for such effects, and not slower either.

I really think fluid sim can give us some procedural generation 2.0, by replacing randomness with something correlated.
But with generative AI on the rise, i might be a little late with that. :D

January 14, 2024 10:43 AM
Aressera

Likely we want to upscale the data in some way so high frequency details emerge.

I have a way to do that already which I use for upscaling non-interpolatable data (e.g. material IDs). I call it “stochastic nearest neighbor”. The idea is to repeatedly do a 2x nearest-neighbor upscaling, but to randomly choose which neighbors to use at each new pixel. When applied recursively this produces a fractal-like result which preserves hard edges yet doesn't show any blocky artifacts like standard nearest-neighbor. I'd like to apply this same idea to the “sparse” tile data format I described, but I'm not sure how to make it work and be consistent between different LOD scales, neighboring tiles, and across the whole sphere.

I have code to do voronoi regions as well. I use it to add crack-like structures to rocks. However it doesn't fit very well into the recursive LOD subdivision scheme I have. The beauty of the existing system is that the work required for each tile is fairly small, and the results from parent tiles contribute larger-scale details. With voronoi stuff it has to be generated from scratch in each tile, which is expensive.

January 14, 2024 05:22 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement