• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

Custom River Stamps

Just an update to correct an earlier assumption that I made about the raw file format:

After using an analysis script on various vanilla stamps (canyon, crater, etc) I've discovered that channel 0 in the raw file is indeed unused in canyon stamps, but it appears to definitely get some use in other types of stamps.

With canyon stamps, any value higher than 0 inside channel 0 causes a blanket "uplift" affect to the stamp. It acts kinda like an alpha offset mask to the heightmap data stored in channel 1, which raises your whole canyon stamp straight up out of the ground by whatever value (or array of values) you put in channel 0. That's not really something you want to ever happen with a canyon, so it makes sense that channel 0 remains unused in that type of stamp.

I have yet to dig into how exactly it's used in craters, hills, mountains, etc. But once this is all figured out, modders should easily be able to add any kind of terrain feature they want to the vanilla random world generator without ever having to write a single line of xml or c#.
 
Last edited:
Inspired by something @zztong was doing with craters, I started working on a python script to procedurally generate raw stamps. Rivers are WAY too complicated to start out with -- especially since I've never worked with procgen algorithms before in my life. So I decided to try out canyons first because that's the type of raw file I know the most about, and because canyons only use 1 channel from the raw file. So it's low-hanging fruit. Zztong has already done some really nice tradional canyons, so I thought I'd do something a little different.

Here are the results of my first attempt at a sink hole stamp:

20250809211921_1.jpg
20250809205900_1.jpg
20250809210117_1.jpg
20250809201406_1.jpg
20250809202537_1.jpg
20250809205530_1.jpg
20250809205424_1.jpg
20250809203341_1.jpg
 
I started working on a python script to procedurally generate raw stamps.

Those canyons I made years ago were basically inverted mountain ranges from around the world. I don't remember how I made them.

Something that becomes possible with a script is that a person could generate some custom temporary stamps prior to making a world, such that worlds become even more unique. The script could accept parameters describing different desired attributes, for instance, the max height of mountains.
 
Those canyons I made years ago were basically inverted mountain ranges from around the world. I don't remember how I made them.

Something that becomes possible with a script is that a person could generate some custom temporary stamps prior to making a world, such that worlds become even more unique. The script could accept parameters describing different desired attributes, for instance, the max height of mountains.

Oh, absolutely. The scripts I've been working are designed with a config block at the top with a number of variables that act as "levers" so that I can easily tweak things like noise amount, erosion intensity, etc. Those variables could easily be set by RNG which would give you random stamps every time you run the script. You wouldn't even have to shut down the game to rerun your scripts, because the worldgen re-reads the stamps every time you hit the generate button in the map menu. So that's a pretty awesome idea!

Btw, after posting these pics, I realized my original rim_falloff_width value wasn't really doing anything inside the sinkhole rim -- it only eroded the top of the canyon and surrounding terrain. So to make it look better, I split that into two separate variables (and associated code): rim_falloff_inner and rim_falloff_outer. That totally got rid of some of the weird artifacts you might have noticed in the above pictures. Here are a couple examples of the new sinkhole version. I made the sinkhole MUCH deeper this time for debugging purposes...

20250810013819_1.jpg
20250810013907_1.jpg

20250810015148_1.jpg

At this depth the "sinkhole" actually looks more like a bona fide canyon, which isn't really what I'm going for. But it shows the improvements I've made to the stamp walls.
 
Here's a really deep sinkhole in the forest biome. Managed to get one without water in the bottom!

20250810145410_1.jpg

My next goal is to add some procedural perturbations to the canyon rim/walls. Currently the stamp is just sorta egg-shaped with smooth, arched lines. It looks okay I guess at ground level, but when you're up on a mountain or in the air looking down, it looks like a giant egg fell from space and left an egg-shaped hole in the world. 🥚 Not ideal.
 
Another reason why you want to break up any smooth, curving lines in your original shape... weird banding and moire-like patterns can form:
20250810155207_1.jpg
 
Okay, figured out what I did wrong. What I'm trying to do is take a circle or ellipse and use a procedural perlin / simplex algorithm to turn a smooth circle into a rough, jagged, natural-looking circular shape. I accidentally applied that algorithm to the entire stamp instead of just the canyon rim. Oops.

Here's the fixed version. All shots are from the ground, because the pattern is too fine to notice from high up in the air:

20250811040202_1.jpg20250811040117_1.jpg
20250811042140_1.jpg
20250811042408_1.jpg

Same stamp, different biomes. The detail this added to the canyon walls looks good but is WAY too fine for my purposes. I'm trying to create really large chunks of jagged rockface in order to break up that perfectly circular canyon rim. So right now I'm splitting my function into two separate passes -- a low frequency pass to REALLY break up that canyon wall into large chunks, and a high frequency pass like you see in these screenshots to add more up close detail and "texture" to the canyon walls.

Gotta say, I've wanted to play around with procgen algorithms for years but always felt intimidated by the math. But the noise 1.2.2 library for python makes this stuff doable even for a hobby coder like me.
 
That was a much tougher job than I expected. But I now have the procedural algorithm both eroding the canyon walls AND reshaping them. The canyon begins as a simple ellipse drawn on an x,z plane, but then the procgen warps and fractures and erodes it into a more natural shape. It uses a random seed for the procgen, so every canyon can be unique. Some pics:

20250812004831_1.jpg
20250812005355_1.jpg

20250812005224_1.jpg
20250812005417_1.jpg
20250812005444_1.jpg
20250812005503_1.jpg

The roughness, erosion and canyon wall deformations are all fully adjustable with frequency, amplitude and octave control for both the low pass (overall shape) and the high pass (fine detail). At this stage it's just a matter of playing with the settings and finding some good default values.
 
Back
Top