More on Shtakamashkan – Creating Masks

We are going to start, today, with the southpole-centered seamask from A Small Update on Shtakamashkan.

Black is land, white is water.

I fixed the thumbnail. The WordPress software doesn’t seem to like grayscale png’s, so I resaved as an indexed PNG. Makes me wonder how badly things will blow up when it comes time to deal with 16-bit heightfields ūüėģ . I’ll probably just put them up as zipfiles. Or not a’tall.

First thing we do is load this mask up in Photoshop or Gimp(What we’re doing here you could probably do on the paint program that comes with your favorite or least favorite operating system). This will be our guide. It will show us where the shoreline is while we are drawing the other masks. In the future, I shall refer to this file as our worksheet.

In order to keep things clear it can be a good idea to recolor this guide layer. Say floodfill the white(land) areas with green and the black(sea) areas with blue. This will require you to change the image mode from grayscale to RGB, but that is fairly trivial.

Add a new layer. Fill this with black, name it, “Black,” and hide it.

Add another layer. It should be transparent to start with. Name it, “Coarse Mountains,” this is where we will start our work.

Now, using a hard white brush, I paint in the broad areas where I want my mountains to be. This isn’t exactly rocket science. Good places to put mountain ranges are near the coast by subduction boundaries(these active shorelines will tend to be a bit straighter than more passive boundaries) like the Andes or Rockies, or continental collisions like the Himalayas or Alps. Other, lesser, more eroded mountain ranges may develop just about anywhere from historical, no longer active orogenies. The Appalachians are on a currently passive boundary, but a few million years ago, before the Atlantic Ocean opened up, they were a collision zone orogeny that would have rivaled or even exceeded the Himalayas in significance.

Once you have these mountains painted in basically where you want them, set the Black layer to visible. Now you should have your mountain ranges delineated in white against a black background. Select all, copy merged, create a new 8-bit grayscale image(you could do 16-bit, but that’s a waste of space at this stage; you could also do a bitmap, but later stages work better with a bit of proper antialiasing on your mask; 8-bit is a good compromise) the same size as your original(I’m using 2000×1000), and paste into the new image. Flatten that and save it as coarse_mountains.png. Yay!

Go back to your worksheet. Hide the Black layer again. For clarity, again let’s fill the white parts of our Coarse Mountains layer with a different color to differentiate it from what we’re working on currently. I picked a nice darkish brown. The choice of color doesn’t matter, because nobody will ever have to see your worksheet. If you like and if your computer gets balky, you can always merge the visible guide layers together. Just make sure they wind up below the Black layer! In any case, make sure that the Black layer is above the Coarse Mountains layer.

Create a new transparent layer above the (currently hidden) Black layer. Name this, “Fine Mountains.” With a much smaller hard white brush paint in finer ridgelines over your existing coarse mountains. Most ranges should have multiple ridgelines, unless they are very narrow to start with. If you like, you can add some additional ridges where smaller, yet fairly sharp ranges might exist.

Some very old, very eroded ranges that you painted into the Coarse Mountains layer might not even have finer ridges drawn into this new layer. They might only exist as broad, soft hummocks on the land.

Once you have your fine mountains all worked out to your satisfaction, unhide the Black layer. Select the entire canvas and copy the merged visible image. In Gimp, for reference, this is done with Edit>Copy Visible, in Photoshop, it’s just Edit>Copy Merged. Create a new 8-bit grayscale in the same size as your original image and save the flattened result as fine_mountains.png.

My overall drawing worksheet.

It occurs to me in retrospect I would also want a highlands mask to denote high altitude regions with less relief than the mountain regions. I’ve done this before, I simply forgot. I will need to add one of those.

We now have a useful set of basic masks that will help us build our world’s elevations. Given time and inclination, we could build additional, more finely detailed masks to further refine our mountains and such. We could also mask out bathymetric details like ocean trenches and spreading rift ridges. In addition to that, we could also work on things other than elevation. We could mask out temperature and precipitation realms for instance. I don’t want this post to go on forever, though, so we’ll keep it simple. Sorta.

For some purposes I need the edges of these masks to be softened, but I don’t want to lose details the way I would with an aggressive feathering or gaussian blur. The key to this is the morphological distance operator in Image Magick. Wilbur has a perfectly decent distance modifier for selections, but I’m on my Mac right now and not eager to switch over. Also, the distance operator in Image Magick is not limited to 8-bit, and I can easily clamp the values to make flat-topped selections. Also, as my skills become more advanced, I can see some real applications for alternative, not necessarily symmetrical distance kernels for the generation of toy climate models and possibly even buildings.

First, I want to make a mask to control the fractal digging out the sea basins. I want it to have no effect along the shoreline and then build up to a maximum strength about 100 pixels away from the shore. All locations further than 100 pixels distance from the shore will be clamped to that maximum strength. Here is the code I use to do that:

convert seamaskRW.png +depth -gamma 2 +level 0,100 -white-threshold 99 -morphology Smooth Disk -morphology Distance:-1 Euclidean:4,'100!' -auto-level ./results/sea_range.png

I’ll try to give a simple explanation of what all of this means. Simple, in this case, may mean a bit stupid, ’cause I’m not too expert with IM and I think I may be oversimplifying in a few places, but it should give a good working sense of what’s going on.

convert seamaskRW.png loads the image file named seamaskRW.png into the convert tool for editing. This was the mask selecting water areas we created earlier.

+depth converts the loaded data into 16-bit format, since the image was less than 8-bits .

-gamma 2 +level 0,100 -white-threshold 99 This basically prepares the antialiased mask as described in Distance with an Anti-Aliased Shape. I’m still a little fuzzy on what all of this means, so I’m just slavishly reproducing it. It works.

-morphology Smooth Disk tells IM to use the morphological smoothing operation on the image with the pregenerated Disk kernel. (This smoothing operation is another one of my ideas that may not have been all that inspired, but the original selection is awfully messy with lots of sharp little splinters that I don’t think look all that good. I’ll be adding more noise over this which should hide some of the artifacts from the relatively big kernel. So I’m going to keep this step. Possibly a tighter kernel, like Diamond might have been better, though.) The meat is in the next part.

-morphology Distance:-1 tells IM to use the morphological distance operator on the image. Euclidean:4,'100!' tells IM to use the Euclidean distance metric. The 4 is the size of the Euclidean distance metric kernel(bigger makes it slower but more accurate; 4 is a good compromise, because it is quite accurate without being too slow; bigger than 4 slows things down more without significantly improving accuracy), ‘100!’ clamps the distance off at the maximum value at a distance of 100 pixels from the shoreline(edge of the selection).

-auto-level this should force the image to use the full 16-bit range of values from black to white.

I’ve played with various contrast and curve operations without finding a suitable shape. I had high hopes for sigmoidal-contrast but found it didn’t meet my needs. Thus, I decided to skip the use of all contrast tools except auto-level.

./results/sea_range.png This is the path to our destination file. As I am using IM on a Unix system, this is in Unix format. Basically, the destination is in a sub-folder of the current working folder named, “results,” and the file is named sea_range.png. Folks comfortable with DOS can probably figure out how this would look on their own system.

The clamped distance mask that will be used to dig out the ocean basins.

The ocean basins will be dug out using a moderate magnitude noise with a very large negative offset

With a bit less explanation we will give you the IM code I used to generate the clamped distance mask I will use to build up the land areas.

convert seamaskRW.png +depth -negate -gamma 2 +level 0,100 -white-threshold 99 -morphology Distance:-1 Euclidean:4,'100!' -auto-level ./results/land_range.png

The main difference, here, is that I inverted the initial mask with -negate before I applied the distance operation. This moved the area of my attention from the sea to the land as I desired. Rather than being based on the distance of a point from land, as previously, the value at each point will be based on the distance from the sea.

The other significant difference is that I am keeping the full detail of the original seamask intact and not using the morphological smooth operator.

The noise I add using this will be of relatively low relief. This is mainly just to delineate the coastlines.

The mask used to raise up the general land areas.

Now we go onto the coarse mountain mask. Big difference here is these areas are much smaller and I will want a more abrupt edge on them. Rather than clamping the distance off at 100 pixels, I think I will go with 30.

convert coarse_mountains.png +depth -gamma 2 +level 0,100 -white-threshold 99 -morphology Distance:-1 Euclidean:4,'30!' -auto-level ./results/coarse_mountain_range.png

The mask used to raise the broader base of the mountain ranges.

This will be used to apply larger magnitude noise with a moderate positive offset.

I don’t have a highland mask, as yet, but I would use the same command to create its distance mask. The noise would be lower magnitude(though still larger than the land_range mask), but with nearly as large a positive offset as the coarse mountains.

The fine_mountains would, again, be similar to the previously generated masks, but with a smaller ease-in, clamped, in this case to 12 pixels.

convert fine_mountains.png +depth -threshold 50% -morphology Distance:-1 Euclidean:4,'12!'  -auto-level ./results/fine_mountain_range.png

I don’t think the 12 pixel limit made any difference in this case. I also ran into trouble using an antialiased source mask, so I simplified to a simple 50% threshold - threshold 50%. At that size I suspect the partially selected fractional gray pixels around the edge dominated enough to make this behave more like a grayscale morphological process than a binary selection.

This is the mask I will use to build up the high mountain ridges.

This mask will be used to apply a fairly high amplitude, high frequency noise with a fairly  high positive offset. Mountains.

Now I have a full set of masks to use in building up my terrains. At least my elevation maps, anyway. If you can look at Special User-defined Distance Kernels and not see an application to quick-and-dirty climate modeling, look again.

Next on to Wilbur to use these things.

Thank you for your attention,
The Astrographer

Advertisements
This entry was posted in Mapping, Planetary Stuff, Projects, Skavoon Project, World Building and tagged , , , , , , , , , , . Bookmark the permalink.

3 Responses to More on Shtakamashkan – Creating Masks

  1. Pingback: Happy Birthday! | Astrographer

  2. templerman says:

    This is an interesting project. I know nothing about the computer generated art skills, though I have seen mesh work for space and science fiction. Geologically this land mass seems to be in a super-continent phase. Assuming that the planet’s core is still active, and plate tectonics are applicable, this land mass would likely be hammered with large tides at the coastlines, and a hot central desert. Although, with the large central mountain chain located in the middle it would possibly have some water/snow at the higher altitudes. However, the rain shadows created by the coastal ranges might prevent water trapping on the central range, unless of course they were higher then say the Himalayas are now.

  3. Astrographer says:

    Thank you. I pretty much lack art skills, period. If I can do this pretty much anyone can.

    Yeah Shtakamashkan is pretty much in a supercontinent phase. I think I should probably rework the mountain structure to take account of the subcontinental boundaries better. That would involve pretty much starting the project over from, boo.

    Definitely the continental interior will be seriously dry in a lot of places, but the map is actually centered on the south pole so that place will be seriously CO-O-OLD rather than hot. The polar location will do as much to make the interior dry as rainshadow would. The arctic and antarctic high pressure zones are seriously strong, probably stronger than the subtropical high that creates the desert bands around 30¬ļ latitude.

    The dryness of the interior might mitigate against the ice cap I depict, but one managed to accumulate on Antarctica. Given enough time in the deep freeze, I figure the interior of Shtakamashkan could do the same. There may be some interesting dry valleys in there too.

    I really should rework Shtakamashkan if only to figure out the astronomical parameters of the planet. How long is Shtakamashkan’s year? Or day for that matter. How much seasonal variation is there? Is the orbit highly eccentric? All of these questions could strongly effect conditions in the interior(and elsewhere). I can’t answer any of them :/

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s