Welcome back…

So that’s been a while since I was able to look at Calenhad but a chance now to do some debugging and try and work out how to include convolutions – that is, processes on the grid for which determining the value at one point means knowing the values at various other points. That in turn means not everything will run on a per-vertex basis in a compute shader. We might have compute shaders with different execution geometry, like “do this to the terrain ten million times” – simulating water erosion for instance – or else doing things in the serial code on the CPU, like loading patches of terrain from files and assembling them together.

OK, so the grid all this will be done on will be a cubic sphere (https://en.wikipedia.org/wiki/Cube_mapping) in which points on the surface are mapped to a grid drawn on the six faces of an inscribed cube. This means we can do convolution calculations with the assumption that the grid points are approximately equidistant, but without the heavy computation and memory cost of an icosphere (the icosphere generator falls over if we ask it for more than ten million vertices). There is an analytical transformation between the coordinates of the points on the surface of the globe and the location on the surface of the inscribed sphere, so we don’t need tables of geolocations for each vertex as we do with the icosphere; and the cubic sphere can be generated very quickly. Filling six grids of say 4096 x 4096 for about a hundred million points covering the globe is still slow enough to want to look again at how we manage the computation within the UI (populating it with billow noise takes the compute shader about a second so complex parallel computations are likely to mess up the UX or time the GPU out).

So after that we will start to create some convolutions – these will be processing modules that include things like smoothing and sharpening filters, erosion simulation, water mapping and terrain levelling, hopefully bandpass filtering using fast Fourier techniques and possibly tectonics simulation on the sphere – for this latter a coarser grid is probably acceptable so we may bring back the icosphere for that. Another desire is to be able to assemble a landscape out of patches culled from DEM files describing real Earth terrain, providing a workflow a bit like this one: http://blog.aratheum.com/gis/cartography/2020/07/25/managing_fantasy_maps_with_gdal-Copy.html.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s