Physically-based analytical erosion for fast terrain generation
1. Physically-based analytical erosion for fast terrain generation
Petros Tzathas1, Boris Gailliton2, Philippe Steer2,3, and Guillaume Cordonnier1
1Inria, Université Côte d'Azur, France
2Univ Rennes, CNRS, Géosciences Rennes, UMR 6118, France
3Institut universitaire de France
Figure 1: Our method receives as input an initial terrain (, left), a map of the tectonic uplift, and a time . Thanks to the analytical solutions of the stream power law, our method outputs the eroded terrain at time , without the need of a costly simulation. Therefore, a user can easily explore the time continuum, from the early erosion of the input terrain (, center left) to the steady state equilibrium between uplift and erosion (, right).
1.1. Abstract
Terrain generation methods have long been divided between procedural and physically-based. Procedural methods build upon the fast evaluation of a mathematical function but suffer from a lack of geological consistency, while physically-based simulation enforces this consistency at the cost of thousands of iterations unraveling the history of the landscape. In particular, the simulation of the competition between tectonic uplift and fluvial erosion expressed by the stream power law raised recent interest in computer graphics as this allows the generation and control of consistent large-scale mountain ranges, albeit at the cost of a lengthy simulation. In this paper, we explore the analytical solutions of the stream power law and propose a method that is both physically-based and procedural, allowing fast and consistent large-scale terrain generation. In our approach, time is no longer the stopping criterion of an iterative process but acts as the parameter of a mathematical function, a slider that controls the aging of the input terrain from a subtle erosion to the complete replacement by a fully formed mountain range. While analytical solutions have been proposed by the geomorphology community for the 1D case, extending them to a 2D heightmap proves challenging. We propose an efficient implementation of the analytical solutions with a multigrid accelerated iterative process and solutions to incorporate landslides and hillslope processes – two erosion factors that complement the stream power law.
1.2. CCS Concepts
• Computing methodologies → Shape modeling;
1.3. 1. Introduction
Terrains are ubiquitous in a large variety of graphics applications, whether they form the background of virtual worlds or the stage of many storytelling artworks. Mountains, in particular, stand out from their monumental presence and the diversity of their features.
It is therefore unsurprising that research in computer graphics has investigated the problem of generating and authoring mountainous landscapes [GGP+19]. Nevertheless, while several approaches work well for small to medium-scale terrains (the scale of the river
to the valley) [EMP+02, BTH06, GMM15], for larger scales up to the scale of the mountain range they lack geological consistency which is prevailing in large mountain structures. Consistency is achieved by approaches based on physical simulations [CCB+17] which are preminent in this case. However, physical simulations require the integration of the geological history of landscapes, leading in turn to long simulation time or numerous iterations before reaching a suitable result.
Our work comes from the observation that there exist analytical solutions to the mathematical equation that expresses the formation of large-scale landscapes resulting from the competition between tectonic uplift and fluvial incision. Thanks to an efficient implementation of these analytical solutions, we obtain a terrain modeling tool that shares the benefits of a physical simulation, but without the cost of thousands of time-stepping iterations. Instead, the temporal component of the simulation becomes another parameter provided to the user, that controls the real-world duration of the erosion process.
The stream power law is commonly used in geomorphology [WT99, BW13] and now in computer graphics [CBC*16, SPF*23] to model large-scale river erosion. Combined with uplift - the tectonically-driven rate of elevation change of the mountain - this results in a Partial Differential Equation (PDE) that describes the formation of the mountain ranges over geological time. Early studies in Earth sciences suggest that this equation admits analytical solutions [RTP13, Ste21] that readily provide a landscape at a time (Figure 1), without requiring the lengthy iterations of a time-stepping scheme. However, these solutions use several simplifying assumptions, for instance, that the terrain is initially flat. We propose a new derivation and fast numerical implementation of these solutions for the more general case, which enables us to reach a larger range of applications, from the instantaneous generation of large-scale mountain ranges to the controllable aging of a user-provided terrain. Inspired by the implicit time-stepping scheme for the stream power law [BW13, CBC*16], our algorithm uses an ordering of the terrain grid cells, starting at the domain boundaries, and following the river network upstream. This strategy comes with a caveat illustrative of the challenges of porting the 1D solution to the 2D setting: elevations are computed based on an order that depends on the hydrology network, but the hydrology network itself depends on the elevations. Previous work [Ste21] developed a fixed-point algorithm that iterates over the successive computation of the river network and then the elevations. Yet, this algorithm converges slowly, requiring too many iterations to be applied in an interactive editing context and assumes flat initial topography. We therefore propose two solutions: one inspired by multigrid approaches to accelerate the convergence, and another that allows small deviations from the analytical solutions and uses optimization to enforce the smoothness of the terrain surface. This added freedom - without sacrificing the geological consistency - provides more flexibility and allows user control. Finally, we observe that the solutions to the stream power law yield a singularity that results in infinitely large slopes close to the ridges - where geologists suggest that other erosion processes dominate [LD03]. Therefore, we explore solutions to include approximations of other processes such as hillslope and thermal erosion. We demonstrate the applicability of our method through a variety of results, that show the versatility of the analytical solutions that are able to quickly generate large-scale mountains (Figure 1, right), as well as providing a fast physically-based erosion tool (Figure 1, center left).
To summarize, we claim the following technical contributions:
- 1) We extend the derivations of analytical solutions for the stream power law and propose an efficient implementation that covers a range of applications from the postprocess erosion of a user-provided terrain to the generation of terrains ex nihilo.
- 2) We accelerate the convergence between elevations and the river network,
with an accurate approach inspired by multigrid and a more permissive one via optimization which allows for more control over the hydrology network.
- 3) We incorporate other processes such as hillslope erosion and landslides (thermal erosion).
1.4. 2. Previous Work
Terrain generation methods are generally classified among three main categories: example-based (or data-based), procedural, and physically-based [GGP*19]. Our new analytical model - inspired by previous work in Earth sciences - is, in essence, a physically-based procedural method.
Data-driven - or example-based - methods assemble terrains from patches or statistics extracted from the topography of real examples, typically captured by satellites. Initially inspired by texture synthesis [ZSTR07, GMM15] and extended to machine-learning [GGG*17], these methods are fast, controllable, and provide an unmatched realism at a small scale.
However, data-driven methods are unable to ensure geological consistency. While this is not noticeable on a small scale, inconsistencies at a larger scale can have a critical impact for instance on the river network, where some streams can end abruptly. Scott et al. [SD21] demonstrated the negative visual impact of these inconsistencies and proposed a correction by carving a realistic river network as a post-process. While this approach fixes the river network, several inconsistencies in the distribution of valleys and elevation remain and reduce the realism at a large scale.
Procedural generation [EMP*02] builds terrains from a combination of mathematical functions, especially multi-frequency noise that mimics the self-similarity of nature across scales [MVN68]. This mathematical foundation leads to methods that are extremely fast, parallel, and unbounded in size. These approaches are usually hard to control, although this issue has been recently alleviated, either by local editing tools such as noise brushes [dCB09], global interpolation around diffusion curves [HGA*10], or in the gradient domain [GPM*22]. It is, however, still difficult to ensure the realism and consistency of the results. One solution is to build the terrain around a procedural river network [GGG*13] which ensures hydrological consistency. Thanks to our analytical solution of the physical equations, our model ensures consistency of the hydrology network and the topography, and introduces a temporal parameter.
Physically-based methods were inspired by the geological knowledge that landscapes are shaped by the combination of various processes [WT99, WHBY22]: climate which modulates the rates of erosion, and tectonics which controls the uplift rate (the rate of vertical growth of the mountain). In computer graphics, researchers initially modeled the most visible factor: erosion, which was first used as a post-process over a procedural or user-modeled terrain [MKM89]. This method was refined with data structures and algorithms for strength-varying layers of rocks [RPP93, BF01], and by improving the water model with Shallow Water equations [Ben07], Smoothed Particles Hydrodynamics [KBKv09] and GPU implementations [VBHS11].
Methods that simulate hydraulic erosion handle the water dynamics explicitly, which, in theory, increases the physical accuracy of the erosion but introduces numerical constraints that limit them to a smaller spatiotemporal extent. To compensate, the results are scaled up, which therefore reduces the overall plausibility. In contrast, fluvial erosion methods implement models developed in geomorphology, for instance, the stream power law [WT99]. These laws abstract water physics under simpler proxies, e.g., the drainage area that represents water flux (or discharge), which yields simulations that can efficiently cover much larger time spans. Therefore, fluvial erosion allows a tight coupling with the growth of the mountain under tectonic uplift [CBC+16] to model the formation of large-scale mountain ranges. Uplift was also proposed as a guide for the user to shape the landscape [CCB+17, SPF+23]. We build our analytical model upon the laws introduced by fluvial erosion methods, but our mathematical treatment removes the need for costly iterations inherent to simulations.
Earth sciences commonly use simulations to understand the formation of mountains. The variety of models adapted to many use cases is immense [CDM14] and out of the scope of the paper. Therefore, we will focus on the family of methods shared with computer graphics that build upon the stream power law [HK83, WT99]. Several implementations were proposed: fast implementations of implicit solutions [BW13], enhancement of a numerical model with analytical solution near the ridges [GWHB14], or the inclusion of sediment deposition.
Early analytical solutions were introduced, first on models that simplify the treatment of the water discharge [Luk72, Luk74] and introduce the method of characteristics for erosion equations. This idea was later extended to the stream power law [RTP13] that simplifies the problem thanks to a translation to dimensionless variables. Eventually, Steer [Ste21] proposed a solution to the 2D problem and tested it with several scenarios, to study in particular the response of the landscape to temporal variations in the uplift, which is an important question in geomorphology. However, some questions were left open and we to answer them in this work, such as the case where the initial terrain is not flat, which allows us to erode existing terrains. Furthermore, their method used an iterative algorithm to enforce the convergence of the analytical solution, which we accelerate with an approach inspired by multigrid.
1.5. 3. Background and overview
Geomorphology explains mountain formation as the competition between mountain growth and fluvial erosion. In this section, we will explain the underlying equations, show the challenges behind analytical solutions, and provide a high-level overview of our algorithms and data structures.
1.5.1. 3.1. Landscape dynamics in geology
Mountain formation is generally associated with tectonic plate convergence, mantle dynamics, and/or volcanic activity. In the context of tectonic convergence, the eventual collision of the plates leads to a thickening of the crust accommodated by visco-elasto-plastic deformation, brittle rupture (faults), and folding of the rock layers [Avo03, GCG+09]. The thickening leads to a vertical upward motion of rocks towards the surface, referred to as rock uplift,
which competes with erosion and can lead to a progressive increase in the surface altitude, called surface uplift [EM90]. Rates of rock uplift and erosion vary in space and time and achieve values up to a few millimeters per year in some mountain ranges.
The uplift is counteracted by erosion, which impacts the slopes of the mountain and therefore its maximal elevation. Erosion comes from many factors: water, glaciers, landslides, wind, and even anthropic or biological impact. Many models in geomorphology consider only erosion by water, also called fluvial erosion. Indeed, the fluvial network is considered the backbone of landscapes, and fluvial incision dictates the rate of landscape erosion [Whi04]. While simple to model, fluvial erosion explains the main topographical characteristics of most mountain ranges and has been the dominant erosion factor over many geological periods - with the notable exception of the last million years, where the Quaternary saw an important increase in glacial erosion that leaves specific marks in high altitude [PMD01, ENPL09, SHV+12].
A first common modeling approximation is to consider surface evolution as a detachment-limited process (as opposed to transport-limited) where the evolution of surface elevation is directly related to the competition between rock uplift and erosion rate, and not to the capacity of the rivers to transport or deposit sediments [How94]. In this setting, erosion is generally described using the stream power incision model [HK83, How94, WT99, Lag14], where erosion rate is a power law of the surface slope , and drainage area that acts as a proxy for the river discharge. The drainage area is defined at a position as the area of the drainage basin - or catchment - upstream of . Coupled with the uplift , the Stream Power Law expresses the rate of change of surface elevation:
where , and are erosion coefficients. Throughout the paper, we will use some of the common values: and . The choice of , also commonly used in geomorphology, makes the equation linear and therefore simplifies the derivation of the analytical solutions. While this choice barely impacts the result as the valley profiles are mostly directed by the ration , we acknowledge that the actual values of and remain an open question in geomorphology [Lag14].
Eqn. 1 is a linear hyperbolic Partial Differential Equation (PDE), which can be interpreted as an advection of the initial terrain along the rivers, at a velocity . This equation admits analytical solutions in 1D that can be computed thanks to the method of characteristics [Luk74, RTP13], and used to model 2D heightmaps [Ste21].
1.5.2. 3.2. Challenges and algorithm
Throughout our implementation, we use a regular grid as our data structure – a standard for terrains that eases the multigrid-inspired technique that we introduce below. This grid initially stores the user-specified uplift , initial elevation , and boundary mask : each cell where is True will force its altitude to remain constant: . At least one cell should be specified as a boundary to ensure that the erosion problem is well-posed. The grid is progressively augmented with all the intermediate values needed by our implementation, including the drainage area . Our output is a regular grid containing the final elevation .
Figure 2: From a user-provided initial terrain , uplift map , and target time (left) our method outputs the eroded terrain at time . Contrary to simulation-based approaches, our algorithm does not rely on a time-stepping scheme but uses the analytical solutions of the stream power law. To compute these solutions, we rely on a multi-grid accelerated process that iterates over both the computation of the river networks and the computation of the elevations predicted by 1D analytical solutions embedded in these rivers (center left). Optionally, the user can choose to interrupt this iteration before convergence, for example, to preserve the initial river network, and in this case, we propose an optimization-based approach to smooth the remaining discontinuities (center right).
Analytical solutions were exposed in the geoscience literature [Luk74, RTP13, Ste21] but with some restrictions: either these solutions are in 1D [Luk74, RTP13] and the proposed algorithms are not straightforward to extend to 2D, or the solutions are in 2D [Ste21] but are restricted to a simplified case where the initial elevation as well as the bounds are assumed to be zero, and the uplift is constant in space. In Section 4, we detail our first contribution which is the derivation and implementation of the analytical solutions in the general case, compatible with a 2D setting.
We follow [Ste21] and order the computation along the river network. This network consists of a set of trees that covers the terrain and represents the progressive merging of high-altitude small streams down to the larger rivers. We obtain the 2D analytical solution by solving the 1D problem on each upstream path embedded in the tree structures. Similarly to the previous implicit time stepping schemes for the Stream Power Law [BW13, CBC*16], we separate the computation into two parts: first we accumulate the drainage area by following the river directions from the high elevations (ridges) of the terrain to the bounds, then we evaluate the analytical solution upstream from the bounds to the ridges.
This strategy leads to a second issue that hinders the optimal complexity of our algorithm on a stream tree: the elevations obtained from the implicit solution depend on the ordering of the nodes in the river network, which itself depends on the elevations. In practice, this leads to the formation of discontinuities at the boundaries of drainage basins. A solution is to use a fixed point algorithm: start with the initial elevation , compute the corresponding drainage , and then iterate over a progressively improving sequence of elevations and , that eventually converge to the desired solution . A straightforward implementation of this algorithm converges [Ste21] but requires at worst a number of iterations proportional to the length of the longest river in the terrain. In Section 5, we propose two solutions to reduce the number of iterations (Figure 2):
- • We observe that the convergence speed is limited by the fact that basin boundaries can only move by one cell per iteration, and
therefore introduce a method inspired by multigrid to move the bounds across different scales.
- • We propose an alternative strategy that does not require any change in the drainage, but instead uses an optimization to find a terrain as close as possible to the analytical solution but without discontinuities.
We show how we can combine these two approaches to allow the user to specify the desired accuracy of the final terrain in a continuum between the geologically accurate solutions provided by multigrid and a result that preserves the hydrological features of the input terrain, enforced by our optimization.
Our last challenge lies in the fact that the solutions to the Stream Power Law lead to singularities close to the ridges: the amount of water decreases when we approach the higher parts of the mountain, which are therefore less impacted by erosion and eventually degenerate into infinitely steep slopes. In practice, fluvial erosion is negligible or even not applicable in these locations, in which other erosion processes dominate. In Section 6, we propose some geomorphological-inspired modeling strategies to mitigate this issue, by adding terms that mimic other erosion factors, such as landslides (or thermal erosion) [MKM89], or hillslope erosion [BS97].
1.6. 4. Analytical solutions of the stream power law
Analytical solutions of the stream power law describe elevations of an eroded terrain at a given time , without requiring the many iterations of a time-stepping scheme. Existing 1D analytical solutions in Earth sciences [RTP13] simplify the derivation thanks to dimensionless variables, which complicates their algorithmic treatment. We instead describe how to derive the solutions with the natural variables and how to infer an efficient algorithm to evaluate them.
1.6.1. 4.1. The method of characteristics for the stream power law
Eqn. 1, with , can be rewritten as:
which falls in the category of hyperbolic partial differential equations and can be solved by the method of characteristics [RTP13,
Ste21]. This method consists of finding a family of space-time curves, called characteristic curves, along which the equation becomes an Ordinary Differential Equation [ZT86].
Our first observation is that the spatial component of the characteristic curve follows the direction of the topographic gradient . Intuitively, this means that the elevation at any point in the terrain will only depend on elevations downstream of , by following the path of steepest gradients. We call this path a river path as this is the trajectory naturally followed by the water, and parameterize it by , the distance between the bound () and any point on the path (Figure 3, left).
Figure 3: We compute the analytical solutions along a river path (left), parameterized by the distance to the bounds. We add the time component to define the set of characteristic curves (right), each of them associated with a given position and time where we want to evaluate the elevation. Here, the curve passing through intersects the horizontal axis at , in which case the elevation is advected from (Eqn. 8). The curve associated with intersects the vertical axis, suggesting that the system already achieved steady-state (Eqn. 9).
Along this path, Eqn. 2 simplifies as:
where . Note that we assume that does not depend on time – we observed that, after some time, the drainage stabilizes in the main river channels. A solution of Eqn. 3 was proposed in Earth sciences [Ste21] with the assumption that is constant in space and varies in time, which is important for geomorphologists who study the erosional response to tectonic perturbations. We prefer an orthogonal approach where the uplift varies in space but not in time, as we expect the uplift to be easier to control for the user as a function of space alone [SPF+23].
We use the following assumptions at the bound:
The constraint that the uplift vanishes at the boundary ensures the well-posedness of the problem, as otherwise the mountains would keep growing indefinitely.
The method of characteristic relates space and time on a set of characteristic curves with the equation:
As we seek the elevation at time and position , we only consider the curve that includes the point . For this curve, the space-time relationship is expressed by defined such as , which gives after integration:
Note that parameterizes time, and therefore should remain positive. The function being strictly increasing, we define a point by , such that the characteristic curve is only defined when . This is illustrated in the right of Figure 3 by the curve associated with . The other curve – going through – shows a case where does not have a solution, and for which we set .
Then, along the characteristic curve, Eqn. 3 is rewritten as:
which we integrate on the domain of definition of the curve , to obtain the formula for the elevation:
Note that for large or small , can be negative, in which case the boundary assumptions (Eqn. 4) gives the solution:
If this happens for all cells in the terrain, this solution corresponds to the steady state of the stream power law.
Compared to previous simulation-based methods that required iterating over time, this solution directly expresses the elevation of the terrain from the uplift and drainage area. This is why we follow geology literature [Ste21] to call this an analytical solution (with respect to time), even if we need to resort to a numerical evaluation of the integral over space.
1.6.2. 4.2. Recursive algorithm for the 1D analytical solutions
Solutions based on dimensionless variables in 1D [RTP13] evaluates the solution at dimensionless positions, with a non-trivial mapping to real positions. Instead, we first propose a numerical evaluation of the analytical solutions (Eqn. 8) on the 1D case, at the real positions along the river path. We will explain in Section 4.3 how we use this solution to model 2D heightmaps. For now, we assume that all the values (, , ) are known and stored in a 1D array. We denote by the spacing between cells of the array.
Our goal is to compute all the elevations in the array, essentially fixing and varying . A naive implementation of Eqn. 8 is inefficient: for each position , we would need to parse the array from to to compute the integral, resulting in a quadratic complexity. Instead, we observe that significant portions of the computation is similar among neighboring cells of the array, which means that the computation of the elevation at a position can use data already computed at the previous position . This observation suggests an iterative algorithm, which parses the array and progressively computes the elevations in a single iteration.
We introduce the function :
which gives the time required for the elevation to be advected from position to . The first step of our algorithm is to compute , defined implicitly by , or
Eqn. 11 is not well defined for small or large , which are cases where the information would need to be advected from beyond the boundaries of the domain. To detect this situation, we set and parse the array from the bound, progressively evaluating until we find the first for which . We set for , and, assuming that is locally constant near :
Then, we propose a recursive formulation to compute elsewhere. For a given cell position , we assume that we know . Writing Eqn. 11 for both and results in:
We approximate the left-hand side of Eqn. 13 as . Starting from , we progressively parse the array until we find the highest such that , which allows us to split the integral and rewrite Eqn. 13 as:
and, again using a locally constant approximation of , we obtain:
Note that for each , we parse a portion of the array to find and compute . However, the sum of the size of all portions seen during the whole execution of the algorithm does not exceed , with being the size of the array, which leads to linear time complexity.
With computed, the first term of Eqn. 8, comes naturally from the linear interpolation of the value of at the two cell positions enclosing the position .
Next, we compute the second term of Eqn. 8. We rewrite Eqn. 8 as:
Where represents the difference of elevation between positions and and results from the balance uplift and erosion:
We use the notation as a shorthand for , and propose another recursive formulation to compute from . The
boundary condition gives the initialization: , and, by decomposition of the integral,
We have , and compute , parsing the array between and , progressively accumulating . Note that and do not necessarily coincide with cell boundaries, and therefore the evaluation of the integral close to these end-points needs to be scaled by the distance between them and the closest cell boundary.
Here again, the sum of the sizes of the sub-arrays that we parse at each subsequent step of the recursion is smaller than , resulting overall in a linear time algorithm.
In summary, our algorithm consists of the following steps:
- 1. Iterate through the array and accumulate to find , deduce from Eqn. 12.
- 2. Iterate through the array to progressively compute with Eqn. 15.
- 3. Iterate through the array to progressively compute with Eqn. 18.
- 4. Compute the final elevation with , where is obtained by linear interpolation.
1.6.3. 4.3. Extension to the 2D terrain domain
We now show that our algorithm for the 1D solution of the analytical equation readily extends to the 2D solution by changing our computation domain from a line to a tree covering the terrain surface. We explained on Section 4.1 that the analytical solutions are computed along a 1D river path, that follows the steepest path on the terrain. In practice, rivers merges into an algorithmic tree structure, that we call a river tree, and we call the set of all river trees the river network or hydrology network. On a river tree, each node has a single downstream neighbor, on which we can apply directly the recursive formulations from Section 4.1. In practice, this requires ordering the computation so that it follows the nodes of the tree, which is suggested by the literature on implicit solutions to the stream power law [BW13, CBC*16] or previous attempts toward analytical solutions in the geology literature [Ste21].
The ordering is (weakly) defined by assigning to each cell of the terrain a receiver , which is one of the four direct neighbors to the cell, and whose elevation is strictly lower than the cell. In our case, we choose the receiver randomly, with a probability proportional to the difference in elevation between the cell and its lower neighbors. We prefer a random sampling over the deterministic choice of the lowest neighbor [BW13, CBC*16] that was designed for irregular grids and yields the formation of uniform axis-aligned valleys on regular grids. (Figure 8). Furthermore, the noise induced by the randomization results in more naturally diverse patterns. To ensure the deterministic behavior of our algorithm, we precompute and store the random variable used by each cell to sample the receiver.
This ordering results in a set of river trees whose roots correspond to the bounds of the terrain and whose leaves correspond to the ridges. The inset figure below shows the river network for a terrain, different colors corresponding to different trees.
We parse this tree in two directions: first, we accumulate the area of the cells from the leaves to the root to compute the drainage area . Here, a topological sort on the tree guarantees the correctness of the computation of from the invariant that any cell is evaluated after all upstream cells [BW13, CBC+16, Ste21].
Then, we parse the tree in the other direction, from the root (bound) to the leaves, to evaluate the analytical solution. The 1D recursive algorithm (Section 4.2) translates directly to that case: each cell at position has a single receiver that plays the role of the cell at in the recursive formula (Eqns. 15, 18). The main issue, which distinguishes us from previous work, is that our algorithm relies on operations located at the advection location , downstream of the evaluated cell. We tackle this issue by using another ordering for this step: with a depth-first search, we can record the sequence of cells between the bound and the current cell, and use this sequence to evaluate the integrals involving in Eqns. 15 and 18.
Strategies based on ordering share a common pitfall when local minima are present on the terrain – and analytical solutions in particular are not well defined for that case. Following previous work [BW13, CBC+16], we rely on a depression carving algorithm [SD21] to reroute some of the cells as if breaches were carved in the terrain to allow for the water to flow out of all local minimum.
The choice of a single receiver results in an incorrect evaluation of the slope of the terrain (as requires the spatial derivative from both the and directions). We compensate for this approximation by introducing a correction term: for a cell at position with a receiver at position , we change to . Note that we still evaluate the spatial derivatives of downstream, as the difference between the cell elevation and the lowest elevation in the and directions, respectively. The inset figure shows the difference between not using (top) and using (bottom) the slope correction, with highlights on the isolines of a terrain constructed by enforcing a constant slope upward a boundary circle. The correction removes the directional artifacts and yields the expected concentric isolines.
Note that we need an existing terrain to compute both the ordering and the aforementioned correction term, which yields an interdependency between the ordering and the analytical solution: the analytical solution requires an ordering to provide the elevation at time , but the ordering requires the same elevations. We will discuss strategies to combine ordering and analytical solutions in the next section.
1.7. 5. Combining river network and elevations
The 2D analytical solutions presented in the previous section depend on an ordering of the river network, which itself depends on the elevation predicted by the analytical solutions. This problem leads to significant artifacts in the result if we follow a simple strategy such as using the ordering of the terrain : large discontinuities can occur in the analytical solutions, mainly at the boundaries between drainage basins which correspond to leaves of the river trees, leaving unrealistic large cliffs in the landscape (Figure 4, left).
1.7.1. 5.1. Fixed-point algorithm
To solve this interdependency, [Ste21] suggested using a fixed point algorithm, that starts with , computes the ordering (and correction), evaluates the analytical solutions, and iterates until the elevation converges. However, this corrects the ordering slowly because only the leaves of the trees can change their connectivity at each iteration, leading to an upper bound for the number of iterations corresponding to the number of nodes of the longest river.
We observed that this algorithm converges for the steady state case (large ), but could sometimes oscillate, especially for small , small uplift, and large discontinuities in the initial topography. We address this issue with an exponential moving average (at each iteration, we average the topography predicted by the steady state with the elevations resulting from the previous iteration.)
The large number of iterations required limits the applicability of analytical solutions to interactive applications and hinders their benefits compared to a full simulation. Therefore, we propose two strategies: one inspired by the theory of multigrid – which still performs this iterative process but with fewer iterations at different scales, and the second using an optimization to reduce the discontinuities provoked by a mismatch between the ordering and the elevations.
1.7.2. 5.2. Accelerating the convergence via multigrid
Multigrid is commonly used to solve elliptic PDEs with a coarse-to-fine approach, first on a coarse approximation of the problem, which is then progressively upsampled toward the final resolution. This strategy accelerates the propagation of low-frequency information, which is similar to our needs and motivates the design of a multi-scale algorithm to accelerate the convergence.
We use a mipmapping type of downsampling operator where the elevation is averaged between neighboring nodes, which we apply to the initial terrain , the uplift , and the boundary condition , down to a user-specified minimal resolution. We then compute a few iterations where we subsequently order the nodes and compute analytical solutions, similarly to Section 5.1. We upsample the resulting elevation with bilinear interpolation to reiterate this process on the next scale. A simple upsampling tends to produce a regular spacing of the rivers that follows the blocks of the lower resolutions (inset, top), with sharp turns. We prevent these artifacts by adding some jittering (inset, bottom) during the upsampling process, where a uniform random offset in is added to the locations of the nodes before interpolation.
After experimenting with several cycles from the multigrid literature, we observed that an up/down-sample strategy inspired by the simplest V-cycle gives the best trade-off between speed and accuracy. In practice, we mostly use around 4 – 5 levels and 5 – 6 iterations, which are enough to remove the most noticeable artifacts. If artifacts remain, they are generally solved by adding more iterations, but we prefer using the optimization algorithm presented next as a postprocess as it reduces the need for tuning hyperparameters.
1.7.3. 5.3. Optimization-based altitude correction
Our multigrid algorithm efficiently updates the river network to remove the discontinuities but is not applicable in all situations. For instance, a user might want to preserve the original drainage or use a procedurally generated river network [GGG+13, GBG+19]. For these cases, we assume that the river network is given and fixed, and we find the minimal correction to the analytical solution that removes the discontinuities. Figure 4 shows the discontinuities seen after applying the analytical solutions directly to the initial river network (left), and how the discontinuities were removed by our optimization method (right).
Figure 4: Discontinuities observed after the computation of the analytical solution on the initial river network (left), corrected with optimization (right).
Let us define a non-connected neighbor of a cell as one of its 4 direct neighbors such as is not a receiver of and is not a receiver of . We denote by the set of non-connected neighbors of a cell . We detect a discontinuity when the elevation difference between a cell and a non-connected neighbor at position is larger than the elevation difference between the cell and its receiver ():
Reducing the discontinuity requires raising , lowering , or some combination of both, and then propagating these changes downstream and upstream. Along a single river, multiple such situations may occur and they might also lead to conflicting changes. Therefore, we developed an optimization algorithm that is more prone to balance these different constraints, rather than a deterministic algorithm based on a parsing of the river network.
A key insight of our algorithm is that we work on the space of elevation differences , which has two advantages. First, it simplifies the treatment of the non-negativity of the slope: to preserve the river network, we force . Second, the elevation is reconstructed by accumulating the elevation differences, this propagates the influence of each constraint along the entirety of the tree at each step of gradient descent, while an approach based on the elevations would only propagate the information by one cell at each step.
In this setting, the set of elevation differences (or in vector form) is the optimization variable. During the optimization, we recompute the elevation from by accumulating for downstream of , down to the elevation of a boundary node . We use the analytical solutions to compute a target elevation difference .
We build our objective function around two terms. The river term retains the elevation differences given by the analytical solution:
The discontinuity term reduces the elevation difference between a cell and a lower non-connected neighbor so that stays above the receiver of :
We obtain by solving the following optimization problem
where and weigh the two components of the objective.
We remap to and use gradient descent to solve Eqn. 22. The sequential nature of the computation of from is not readily compatible with existing automatic differentiation solver, therefore we show in Appendix A how we accumulate the gradients with respect to throughout the river network. To prevent exploding gradients, we weigh each gradient of the discontinuity term by the number of nodes upstream of - which can be computed from the drainage area as . We use the step size for the gradient descent , which we modulate locally to enforce the inequality .
1.8. 6. Other erosion factors
The stream power law presents a singularity when the drainage area reaches zeros: when time increases, the solution converges to infinitely steep ridges. This is documented by geologists [LD03], who suggest that the stream power is not applicable in these locations, or at least dominated by other processes. We explore two possible predominant processes: hillslope erosion and landslides, and propose approximations to easily integrate them into our algorithm.
1.8.1. 6.1. Hillslope erosion
Hillslope processes encompass the weathering of the mountain slopes and the diffusion that results from the creep flow of the eroded material. It is often simplified as a linear diffusion of the terrain elevation [BS97, SPF+23, CJP+23]:
Where is the hillslope erosion coefficient.
An analytical solution including the hillslope erosion would require joining the stream power law (Eqn. 1) with Eqn. 23 which results in an advection-diffusion equation. Solving this equation needs a global 2D treatment, preventing our decomposition to a set of 1D solutions on the stream tree, and the complexity of the derivations and implementation of the solutions even in the 1D case challenges their usability in a terrain modeling framework.
Instead, we propose another modeling choice for the hillslope erosion, which is simpler to incorporate into our analytical solutions. We observe that, while a solution in the transient case seems out of reach, it is possible to propose a model that has the same behavior as the diffusion equation at steady-state.
Let us consider the 1D steady-state equilibrium between the hillslope and the uplift:
We integrate from to the ridge , where the slope vanishes; and use Hack's law [Hac57] to associate the distance to the ridge with the drainage : , where is a constant in the range [1.4 – 2], and the exponent is usually set to :
Finally, we observe that Eqn. 3 converges to Eqn. 25 at steady state and close to the ridge with a simple modification to the term :
1.8.2. 6.2. Thermal erosion
Thermal erosion is commonly used in computer graphics to model the granular nature of mountains, which are particularly unstable above a critical talus slope:
where is the critical slope. We modify Eqn. 3 to add the contribution of the thermal erosion:
with a new expression for (also including hillslope):
We implement the condition within our algorithm. When we compute Eqn. 18 to obtain the elevation at a position , we first assume that there is no thermal erosion. If the resulting slope is
above the critical angle, we change and to incorporate the thermal erosion with Eqns. 28 and 29, and use the new values to re-estimate the elevation . Note that changing also change , which slightly change the algorithm summarized at the end of Section 4.2: instead of computing first for all , then for all and finally , we interleave them to compute together , , and from their values at .
1.9. 7. Results
We prototyped our algorithm in Python with numpy (the code will be released with the paper). Our algorithms require several tree operations that are not trivially parallelizable, therefore we improved the performance of Python loops with just-in-time compilation provided by the package numba. We used an Intel Xeon E5-2650 v4 CPU with 64 GB RAM to compute all the results and timings reported in this section. We interfaced our code with Houdini [Sid23] to showcase the use of our approach in an interactive editing session (see the companion video) and we use Terragen [Sof23] to produce the final renderings. The parameter values used throughout our experiments are the ones shown in Table 1 and the uplift is constant, unless otherwise mentioned. The code, Houdini file, and heightfields are available at https://gitlab.inria.fr/landscapes/analytical-terrains.
| Parameter | Symbol | Value |
|---|---|---|
| Uplift | ||
| Fluvial erosion | ||
| Precipitation | ||
| Drainage exponent | 0.4 | |
| Hack's law constant | ||
| Hack's law exponent | 0.6 | |
| Hillslope erosion | ||
| Thermal erosion | ||
| Critical slope | 0.57 |
Table 1: Parameters used throughout our experiments.
1.9.1. 7.1. Validation and comparison
Analytical solutions and simulation. The purpose of our algorithm based on analytical solutions is to quickly generate terrains that are similar to the results of a simulation of the stream power law. In Figure 5, we compare between our method (with multigrid, top left), a simulation [CBC+16] (top right), and previous work in geology [Ste21] (Fixed point iteration, bottom left). The comparison is performed at steady-state () as the last method does not handle initial topography and, also, in order to limit the integration error of the simulation. In this example, we use a constant uplift modulated by a subtle noise on a terrain with . In the simulation, we use 460 iterations with , which we found to be the maximal time-step that did not produce visible artifacts. The fixed-point algorithm required 43 iterations to converge.
The strength of analytical solutions is that they do not need to explicitly model the intermediate time states of the terrain, but this
Figure 5: We compare our method at steady state (with multigrid, top left) with a simulation [CBC*16] (top right) and a fixed point algorithm [Ste21] (bottom left). These three methods should produce similar results, which we highlight by comparing their hypsometry (or the density plot of the elevations, bottom right).
| Resolution | Multigrid | Fixed-Point | Simulation | Optim. |
|---|---|---|---|---|
| 512 | 1.79 s | 7.85 s | 55.52 s | 0.94 s |
| 1024 | 8.18 s | 70.89 s | 556.42 s | 4.10 s |
| 2048 | 33.65 s | 538.71 s | 4799.44 s | 16.61 s |
Table 2: Time required to compute a terrain at various resolutions, for our method with multigrid, the fixed point iteration, and the simulation. We also show the total time required to correct the discontinuities with our optimization algorithm in the worst case (the elevations are adjusted to the initial river network.)
means that the river network at convergence is one of the many possible networks that agree with the stream power law. Therefore, it is impossible to measure a one-to-one difference between all three approaches - note that this is a common issue on models involving the stream power law, which strongly depend on initial conditions and implementation choices. Instead, we rely on the hypsometry [Str52] (distribution of elevations) to highlight the similarity between the three results.
Table 2 shows the time required to reach these results for different resolutions. We keep the total extent of the terrain constant, therefore decreasing from 50 to 25 and 12m. We observe that we need to decrease the timestep proportionally to the cell size to prevent artifacts in the simulation, therefore the number of iterations increases in both the fixed point (43, 82, 156 iterations) and the simulation (230, 460, 980 iterations). In contrast, the multigrid methods only require the addition of one level of down/up-sampling, which leads to a complexity almost linear to the number of cells. We additionally show the performance of the optimization algorithm, in the worst case, which is when we adjust the elevations to the initial drainage (disabling the iterative approach). In practice, we observed that the optimization cleans all visible discontinuities after 50 iterations for all resolutions. Overall, we did not observe significant changes in performance with other erosion parameters.
GPU simulations of the stream power law [SPF*23] might in some cases be faster than our method even though they require many iterations. There are, however, caveats inherent to the GPU architecture that prevent them from being used in all cases. First, GPU simulations use an explicit time-stepping scheme, which bounds the admissible time step and can yield a prohibitive number of iterations for small . Second, depressions in the topography lead to local minima that interrupt the river network. Similarly to other CPU algorithms, we use depression breaching [CBC*16, SD21] to enforce the continuity of the river across the depressions. The absence of such an algorithm on GPU implementations is particularly visible in cases where we erode without uplift - all the water is trapped within the depressions and the erosion only occurs in the vicinity of the topographic gradients.
We illustrate this problem in the inset figure, where we use a simulation without depression filling to erode an escarpment for 500ky. While the result should be similar to Figure 12 (right), the erosion remained local to the initial cliff and did not expand toward wide canyons.
Hydrology-based and physically-based. Many procedural methods targeted the instant generation of terrains, often through the use of noise functions [EMP*02]. Closer to us, G nevaux et al. [GGG*13] proposed a procedural approach based on hydrology. They generate a river network whose formation and elevation is guided by a slope map. The elevation of areas between rivers is computed using a second slope map. Since our method, similarly, computes the elevations progressively in the order defined by the river network, we alter the term of Eqn. 3 so as to enforce a small slope for main rivers ( if the drainage is above ), and a stronger slope for the sides of the mountain (), corresponding to the two slope maps of [GGG*13]. In Figure 6, we compare our method (right) with this hydrology-based approach. While the latter convincingly arranges rivers and surrounding mountains, our physically-based solutions yield more diverse patterns at all scales, self-emerging from the combination of uplift, stream power law, and hillslope [CMA*16].