Friday, March 13, 2026

Fluvial landscapes

A topic I return to from time to time is fluvial landscapes. These are common in nature but don't seem to fit naturally into any of the standard classes of 3D recursive shape. This post is about extremely simplified descriptions of them. 

About the simplest is this subdivision scheme:

It takes a plan-view right angles triangle and subdivides it in two, lowering by an amount proportional to the side length. Each iteration it flips between lowering or raising the newly added vertex. This has the basics of a fluvial landscape: fractal roughness, angled valleys and ridges. However the valleys follow a blancmange curve in their profile, so water wouldn't run down it like a real fluvial landscape.

Probably the next simplest is to replace the 'midpoint offset' with a smooth profile. Rather than setting the mid height to (z_0 + z_1)/2 we set it to (z_0 + kz_1)/(1+k) where k=e^{al/2} and a describes how concave the slope is and l is the horizontal edge length. 

Here for a=4:

It is less rough though. An improvement is to change a inversely to the edge length, but only on new edges. This stops tributaries from entering at steep angles near the river source, reflecting the idea that they would need to slow down to change direction as they enter the main stream (which is faster and so more sloping).

While the previous was overly blunt (saturated), this one seems a bit overly sharp (desaturated):
An in-between does the square root of the above slope scaling:
I don't think any of these are a perfect archetype for a fluvial landscape, but they are in the right direction. 

One problem is that lateral valleys on a slope are tilted. It would be nice to find a replacement rule like the ones above that really gives a physical solution to a simple water erosion model. 




Saturday, March 7, 2026

Inversive Substitution Rules

A substitution rule assigns a colour to each self-similar region in a shape, where each colour has its own rule set. It produces a recursive shape which, much like an L-system, generates more complex shapes than simple recursive fractals.

A simple example is the Menger carpet. There are two colours of square, white and black. The rules are:

white: split into 3x3 grid such that centre is black and the rest are white.

black: stay black.

Of course you can get more complicated, for instance you could have four types, labelled white, red, green and black, starting with white:

white → alternating white and red with central black

red → alternating white and red with central green

green → all green

black → all black


Anyway, I'm interested in such substitution rules but for inversive limit sets. 

The idea with these limit sets is that the symmetries are inversions around spheres that connect at dihedral angles that are pi/n for integer n. 

In all cases I have seen of these inversive limit sets there is just a single set of spheres, so generating a simple recursive structure. 

In order to generate more complex shapes we can use substitution rules to mix in different types of inversive set at different locations. 

The key constraint is that when you substitute in a different set of spheres, it must connect identically to its neighbours after some Mobius transformation. 

Here's an example with two colours:

green: a set of 6 (green) spheres that generates a tree structure (left hand side below)

red: a set of 6 spheres that generates a shell structure (concavities). These are all red apart from one green sphere 


So the tree structure is a fractal tree all the way down, but the red shell structure has green protuberences inside each dome. This can only work if there is a Mobius transformation of the green sphere inside the res sphere set, which makes its neighbours match the neighbours of the destination green sphere.

We prescribe this structure by taking the connectivity diagram of the shell structure (left) and making one of the nodes substitute into a node in the tree connectivity structure (right):



The next example uses five generalised spheres to make a cubic-symmetry shell. Ignore the little balls which are a temporary rendering artefact:
We can make a similar structure but with a sphere protruding more to be tree-like in shape:
Now, if we substitute the intruding sphere in the first inversive limit set into the protruding sphere in the second one then we get a mixture of concave and conves:
We can also do it the other way around, substituting in the concave shell onto the second limit set:
again, ignoring the little ball rendering artefacts.


We can do multi-set combinations too. Here is a tree set:
a shell set (red) linking to the tree set
and a ball set (blue) linking to the above shell set:
here it is from another angle:
In each link I linked a single sphere of the set to the child set, as shown here:

For some reason 3-way doesn't work if you use the same sphere id in both links. 
The above spheres were all in line. Here the 3-way link are in two orthogonal directions:
shell->tree:
ball->shell->tree:


Here the two opposite spheres of the 6-sphere blue 'ball' set both link. The left side links to the shell that links to the tree, and the right side links to just the tree. You can just see the remaining blue as a line down the middle:


Here is a 4-way rule, with two levels of 6-sphere balls before linking to a shell then a tree:

This is useful for making something like a planet or moon. You can start with fairly spherical structures, then include the more intricate (e.g. tree) geometry at the smaller scales. But the tree areas aren't just in one location, they are clustered in a fractal set of patches, which I think is nice.


OK, here's a slightly more refined example. We start with a slightly non-spherical limit set, which makes a nice basic planet surface:
Now let's make some slightly better vegetation, four different cluster-trees of slightly different colours and sizes:
We can attach them to the octahedral tiles with a transition tile that links to all four trees:
Now if we take a shell-shell to represent craters on the planet:
then we link one of its 6 spheres to the above tree transition tile, then we get some life on the crater structure:

Now we can apply this shell-shell to one of the six spheres in the planet limit set:
It has added lots of craters and the 'vegetation' down in the craters.
Now modifying a whole 6th of the planet is a bit extreme for a large world, so I've added the ability to direct the link to the next set to any descendant sphere, not just one of the generating spheres. Here it applies it to one child sphere (so 1/36th of the world):
The deeper the descendant that does the link, the smaller the part of the wold it effects. This is a grandchild (so a 216th of the world):
The greenery-filled shell-shell occupies more than a 216th in the final limit set because you don't see just the descendent sphere but the reflections of that sphere over the other parts of the world. 

So this is different to traditional world building, you can specify a location for a patch of terrain by specifying the descendent, but you get a distribution of the structure, not just a single one. This is actually quite nice and natural, many things like forests, water bodies and mountains come in distributions rather than just single items.
 




Monday, January 19, 2026

Parametric functions

Just out of interest, here are the standard functions we are used to, but converting the second differential of the function to curvature instead. Or equivalently, converting gradient to path angle:

x

x^2

x^3

x^4
tan x
1/x
exp x
log x
x^x
normal dist
8.5 * normal dist

But one of the more interesting is probably the sine function, which looks quite different just by scaling up:

sin x
pi/2 sin x
2.11 sin x

2.405 sin x
2.66 sin x
pi sin x
4.7 sin x
5.24 sin x


The coefficient in the figure eight sine wave is more precisely the first zero of the Bessel function J_0. Credit to Greg Egan for pointing that out.

You can also render the factorial function as a continuous curve. However to prevent lots of overlap it helps to divide the angle by four:



In addition to standard asymptotes, this depiction of functions can also in somes cases visualise functions with a domain larger than the Reals. 

For instance, if we take a standard cubic function:

and make it periodic every omega on the Surreal domain by setting:
where r_0 is the cofficient of omega^0 in the Conway normal form of x:
then we can visualise it as:

The green lines are values outside of the Reals.
This example is rather artificial as it explicitly creates an omega-periodic function. It is not clear whether any "standard" function on the Reals that is non-periodic can become periodic on the Surreals. It definitely isn't the case for polynomial functions.