Wednesday, May 8, 2019

The canyons of your mind

I previously explained that when rivers are carved at the regional level, they are placed lower than the base level of their tile's elevation. The amount by which they are lowered is a constant throughout the whole world - I've found 20 metres to give generally good results.

This gives us some variety, as depending on how wide the river valley and how mountainous the area is, we get quite different-looking valleys. But still it would be good if we could vary the constant itself, to give, say, really deep valleys sometimes - and some epic canyons:



But doing this is tricky. For one thing, if the constant varied, then there might be cases where a river runs uphill (if it moves from one tile to another which is only slightly lower but has a much smaller constant). For another, lake surfaces are calculated on the basis of this constant, and if it varies then all sorts of complications would arise.

So how can we get really impressive canyons? My cunning answer to this is: instead of lowering the river, let's raise the land around it. Suppose, during the global map creation phase, we introduce artificially raised areas. These will be superimposed over the normal elevation map - that is, the "real" elevation will be retained on the standard elevation map, but there will be a new array which has, in some places, higher elevations marked. We'll use those when calculating climate and so on.

As always, the rivers will still be calculated on the basis of the normal elevation map (without mountains), not these higher elevations. And when we go to the regional level, the rivers will still be given elevations based on that normal elevation map, lowered by the same constant as usual, just as they are now. But the terrain elevation around them will be based on the higher elevations from our new array (if any are present for that area). This should give the effect of rivers (and river valleys) that are significantly lower than the surrounding terrain, and we might get some nice canyon systems as a result.

First, we create the "extra elevation" array. This is just another fractal, but with lower values so that a lot of it is zero (we don't want extra elevation everywhere, and certainly not over sea). That comes out looking like this:


The highest value here is 500. The sharp edges are coastlines (no matter how high the extra elevation over land, it's always zero over sea). I've applied a blur to it so that it's not too sharp at the coasts - we don't want gigantic cliffs all along them, at least not most of the time.

Now we apply this to the global map. The values in the extra elevation map are simply added to the values in the global map (with mountains). We don't add them to the global map (without mountains) though, because that's the one we'll be using to calculate river elevations from.

That gives us a global map that looks like this:


For the most part, the change is very subtle. The only part of this map where you can clearly see the land is raised as a result of the extra elevation is on that large peninsula jutting off the eastern coast of the big continent just to the right of centre. About half of that peninsula has high extra elevation and it does appear notably elevated on the adjusted map.

So we have our extra elevation applied to the map. Now it's just a matter of making it have the desired effect at the regional level. At the moment, the elevations at the regional level are based on the global map without mountains. All we have to do is change it so that they are based on that no-mountains map plus the extra elevation map. The river elevations, meanwhile, continue to be based on the global map without mountains alone. That should mean that where the extra elevation map is substantial, the rivers will appear to be much lower than the surrounding terrain.

So I first had a look at that peninsula mentioned above, and this is the first map I got:


This is pretty much what I was hoping for. The rivers are carving valleys which are much deeper than before. Because UW only marks rivers of greater than a certain size on the relief map, but all rivers carve valleys, you can see some valleys without obvious rivers in them, giving this terrain a very scored sort of look. You can see the effect on the elevation map of the same region too:


Remember, of course, that the larger the river, the wider a valley floor it has around it. So all the rivers are equally prone to carving deep canyons where there is substantial extra elevation, but only the larger rivers will carve really wide ones.

Zooming in, we get tiles like this:


This is a fairly substantial river (flow of around 1000 cubic metres per second). The terrain to the north of the highlighted square is around 1100 metres above sea level, dropping to 620 on the valley floor. The drop is more precipitous on the north bank than on the south, where the land slopes up in a relatively shallow way to the heights. Why is this? Because the terrain of each tile is based on seeds at the corners of the tile. Here, the elevation of the river has been taken directly from the no-mountains global map. The elevation of the corners of the tile has then been taken from that map plus the extra elevation. The computer has tried to smooth the terrain from the corners down to the already-calculated elevations at the river cells. There is less distance to the northeastern corner than to the southeastern corner, so it's steeper in that direction.

This tells us that to get a real Grand Canyon, with precipitous sides all around to a great height, we'd need a tile where we not only have substantial extra elevation but also rivers flowing in from all directions to ensure that the distances to the terrain seed cells are relatively short, creating steep slopes all around.

For comparison, here's a region where rivers from an area with high extra elevation flow to one with none:


So we can imagine that the high ground in the northeast of this region is made of relatively soft rock, where the rivers have worn away deep valleys as they flow to the lowlands.

One more region I thought was interesting. Here's the river map first:


Look at that river with lots of small tributaries in the north that then flows roughly southeast and reaches the coast about halfway down the image. The elevation map shows what's going on here:


Those tributaries are flowing into a fairly wide depression in the surrounding higher land. But the river they form then flows out of that depression in a deep valley through that higher land, until it emerges to the flatter coastal shelf and flows into the sea. The relief map looks like this:


So the highlands it flows through are actually a big desert. We can imagine this wide, relatively fertile valley, several kilometres across and about 300 metres lower than the surrounding desert. Perhaps camel-mounted nomads journeying across the desert might crest the top of a hill and see the welcome valley suddenly emerge into view...?

So overall I'm quite happy with how this has worked. There will probably need to be more tweakings of the settings of this (I suspect that higher extra elevation might produce good results) but the basic principle is working well, which makes a nice change.

1 comment: