Using “Planet” for 16-bit planetary maps

The map on this page got me to thinking about automated terrain generation again. I’ve discussed the inadequacies of most terrain generation before, and I stand by it. On the other hand, as Realmwright says, there are advantages to exploring and filling in an existing map. Much as die rolls serve to spur the imagination in the generation of other planetary parameters, so does a randomly genned map. That’s not to say I’d use a generated map exactly as is. As a geography guy I feel it’s a matter of honor to improve the terrains and maps I’m presented with.

I had originally thought that the map on Realmwright’s page was generated using Torben Mogensen’s Planet generator, but it turns out that the Donjon generator he links to is actually a working implementation of John Olsson’s(johol) old FWMG generator. The cgi on Mr. Olsson’s online app no longer works properly, but he has some good stuff on how it works as does Mr. Mogensen(under Great-circle Faulting). While I was looking around I got to playing with Planet and other random generators and thought it was time to go over that aspect of worldbuilding. That, and I haven’t had a good post focussed on mapping in awhile, and I enjoy doing those…

Awhile back I generated an entire library of planetary surfaces using planet. I saved the settings(seed[-s], initial altitude[-i], distance variation[-V] and altitude variation[-v]) that control the shape along with small-ish thumbnails(2000×1000) in latlong and Peters projections. I have no particular affection(or disaffection) for Peters projection, but it provides a decent approximation of the resulting world’s hydrospheric fraction. Based on the given hydrospheric fraction, I stored the images and their settings files in one of ten sub-folders(named: “0″ for 0-9.9…% ocean, “1″ for 10-19.9…% ocean and so forth). Random generators, being random and all, aren’t the best thing for providing just the world you want, but it helps if you can shop around a bit…

I’ve been off the Sadwillow project for awhile now, and I’ve since adapted the existing map to use in a competition as Kazh, the homeworld of the Klarr. Well, I needed to alter it a bit for the UNSEA universe anyway. Since the latest version of planet uses a slightly modified algorithm that doesn’t produce exactly the same results from a given input, I decided to feed the settings for the old Sadwillow into planet and see what came out.

Not exactly what I was looking for. A bit drier than I was hoping. Still I kind of like the shapes. Could I somehow invert this...

Not exactly what I was looking for. A bit drier than I was hoping. Still I kind of like the shapes. Could I somehow invert this…

An interesting enough map. A whole lot of dry land. With Sadwillow I was definitely looking for something moist and pleasant with smallish land masses. This looks dry and marginal with large deserts. Just the opposite of what I was looking for. Hmmm… It occurred to me that I could invert a heightfield of this in Photoshop or Wilbur, but I decided to do an experiment.

The original Sadwillow(now Kazh) and this dry little world were generated with a seed of -s 0.26544111354, an initial altitude of -i 0.0227, a distance contribution to variation of -V 0.024 and an altitude contribution to variation of -v 0.386. It also had an offset in longitude of -l 120.0, but we’ll just leave that alone for now, that’s just an adjustment to make the map all pretty-like, I won’t know how to optimize that till I see the final terrain. By inverting the initial altitude, distance variation and altitude variation(-i -0.0227 -V -0.024 -v -0.386), I hoped to create an inverted heightfield. I didn’t know enough to be sure, but experimentation is cheap in this case, so I banged out another test image.

That looks better. A little flat, but random gen never puts the mountains in the right place anyway...

That looks better. A little flat, but random gen never puts the mountains in the right place anyway…

Well! How about that? It looks like my conjecture paid off. So now I have a pretty picture with a bit of hillshade effect. What can I do with this? One thing I did was take it into Photoshop and use the Flaming Pear Flexify 2 filter to convert my image into a cylindrical equal-area projection. Then I used the magic wand to select the ocean areas and the histogram to see what fraction of the total surface are was represented by hydrosphere. It came to about 72.0% hydrosphere. That’ll do. Incidentally, if Sadwillow was the same size as the Earth, with a total surface area of about 510 million square kilometers, the kiwi-shaped continent would have a surface area of about 77 million square kilometers, the continental mass in the northeast(overlapping into the northwest) would have an area of about 38 million square kilometers and the island and little continent that are to the east of the kiwi kissing it on the beak have a total area of about 18 million square kilometers. This would be comparable to the continental cluster of Africa and Eurasia(about 79 million square kilometers), Africa and Australia(38 million square kilometers) and South America(17.8 million square kilometers) respectively. I’m thinking Sadwillow will be a little smaller than Earth, but I still think those landmasses are quite large enough for my purposes. In fact, the Kiwi seems a bit big(let’s just call it that. You know the settlers will.)

Now that we have a satisfactory terrain, how do we earn the name for this post(you know? The whole 16-bit thing?) I found a thread in the shatters.net forums by John van Vliet on this very topic.

Just copy and paste the contents of his 16bit.col file or the code block I have listed below into a text file and save it as… wait for it,”16bit.col”

0 0 0 0
1 65536 65536 65536
2 0 0 0
3 0 0 0
4 0 0 0
5 0 0 0
6 0 0 0
4096 4096 4096 4096
8192 8192 8192 8192
12288 12288 12288 12288
16384 16384 16384 16384
20480 20480 20480 20480
24576 24576 24576 24576
28672 28672 28672 28672
32768 32768 32768 32768
36864 36864 36864 36864
40960 40960 40960 40960
45056 45056 45056 45056
49152 49152 49152 49152
53248 53248 53248 53248
57344 57344 57344 57344
61440 61440 61440 61440
65536 65536 65536 65536
Once you have that saved in the same folder as you have planet, then you start up a terminal(this is all CLI), set your working directory to the folder with planet, and enter the following:
./planet -C 16bit.col -x -s 0.26544111354 -pq -w 2000 -h 1000 -o sadwillow2.xpm -i -0.0227 -V -0.024 -v -0.386 -l 120.0

Your mileage may vary, but I don’t have any image editors on my computer that handle xpm. At least not in 16-bit. That’s okay. If you don’t have Image Magick on your computer, I’d strongly suggest you go and grab a copy. I’ll wait for you…

That wasn’t so hard. MacPorts even has an easy option to compile it in 32-bit. No muss, no fuss. On a Macintosh, of course. They have direct downloads of 8- and 16-bit versions for Windows and various Unices, so that much shouldn’t be too hard. For this purpose, the Q16 build will be both necessary and sufficient. Q32 should work, but won’t be necessary.

Once you have IM installed nicely, try the following code:
convert sadwillow2.xpm sadwillow2.png

The result should be a nice 16-bit greyscale png suitable for opening in any version of Photoshop later than version, I think, 5.

This is a fairly low quality, 8-bit JPEG of the heightfield, 'cause WordPress doesn't handle 16-bit PNGs all that gracefully. It's also kind of small, but it's just to demonstrate.

This is a fairly low quality, 8-bit JPEG of the heightfield, ’cause WordPress doesn’t handle 16-bit PNGs all that gracefully. It’s also kind of small, but it’s just to demonstrate.

There you are. You are now the proud owner of a 16-bit heightfield produced by tetrahdral subdivision as implemented in Torben Mogensen’s world-famous, fancy-dandy planet generator.

Now all I need to do is boot up my Windows partition, open this in Wilbur and port it to hf2 or bt format.

I could do the same conversion here on my mac with GDAL
gdal_translate -ot Float32 -of BT sadwillow2.png sadwillow2.bt
, but since I expect to be hand-modifying significant parts of this heightfield, Wilbur would probably be the way to go. Also setting the geographic extents in Wilbur is pretty easy and kinda miserable in GDAL. YMMV.

Enjoy. I’d love to see any cool worlds you create with the help of this. Just drop a line…

The Astrographer

About these ads
This entry was posted in Mapping, Planetary Stuff, World Building and tagged , , , , , . Bookmark the permalink.

5 Responses to Using “Planet” for 16-bit planetary maps

  1. Realmwright says:

    Thanks for the name drop. Would you mind making that a link so folks can find their way back to my post? I like how Kiwi/Khaz came out, but I thought I’d mention that instead of all that flippity-jibbit about land and sea inversion, you could just keep clicking away on donjon until you find landmasses you like, then change the % of water. And, did you imply I’m dishonorable? ;)

  2. Pingback: More Work With Planet | Astrographer

  3. Pingback: Smoking GRASS | Astrographer

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