# Martian Landscape: Technical Details

Mathematically, this is an offshoot of the Tarot Art Tool Project. I used the same basic layout tool -- I was laying out line segments and spline curves. But instead of computing a vector field and then drawing pen-strokes along it, I did... well, a number of things.

The basic idea was to write small pseudorandom algorithms, which could produce the artistic elements of Chinese and Japanese landscape art. (At least, mechanical imitations thereof!) I wouldn't have to lay out every branch of a tree; I could just plant a tree and tell it how to grow. Since the algorithm uses a pseudorandom number generator, every tree is different -- but each tree comes out the same every time I run the program. (This is important. I may not be able to draw a good-looking tree, but if I come across one, I want to keep it.)

Consider the hills and mountains, for example. I wrote code to follow a spline curve, laying down little black arcs of varying sizes. Some arcs had smaller arcs below. Quite a simple algorithm, but it worked; it looked like a stylized hill line. (I added the ability to set attributes on individual curves, to influence the algorithm. The hill algorithm checks a size attribute -- that's why the "farther" hills are smaller -- and a color attribute, and a few others. Note that the color-influence uses the same integral as the Tarot project... the closer you are to the hill line, the stronger its color is.)

The trees do use vector fields -- they grow according to another simple algorithm, following the local field. (So I can have trees that lean, or seem to be blown by the wind.) But unlike in the Tarot art, these fields are not produced by the other visible elements of the image. The trees don't follow the vectors of nearby hills, in other words. That would look silly. I added a class of spline curve which has no visible output, except for influencing the growth of trees.

The colorful temples -- yes, I intended them to be reminiscent of Icehouse pieces -- are just piles of blocks. The edges and surfaces are sketched out with random strokes. The code here actually contains many of the elements of a 3D renderer, although of course it's a very simple and specialized task.

Some of the images have clouds and mist, or bands of wave crests, or distant forests. Here I used most of the vector-field architecture from the Tarot project. I lay out a curve, which influences the stroke density, stroke size, and color in the area around it. The actual strokes don't follow the local vectors -- it's more like my dot image tests, except that I draw a horizontal streak, pine tree, or a single wave crest instead of a dot.

I'm probably making all this sound more elegant than it really is. This tool is a mash of different approaches; it's pretty cobbled-together and hard to extend.

For example, I started out with an architecture in which each spline curve generates exactly one visual element -- a tree, a line of hills, a temple. Simple, right? But the waves and clouds are collective elements. All the cloud curves add together to produce a single field -- a six-dimensional field, in fact. (Three dimensions for color; one each for stroke density, stroke length, and stroke thickness.) So my program wound up with a nasty multi-stage pipeline: figure out the cloud field, figure out the waves field, generate the cloud and wave strokes, draw all the individual elements, draw all the cloud and wave strokes...

Oops, that's not right. These images have depth -- nearer objects have to obscure farther objects. Now every curve needs a depth attribute! And the cloud field becomes seven-dimensional, since I need to know the depth at every point too...

Oops, the color needs work. I didn't like the pixelized color backgrounds I'd used in the Tarot project. Too square and computer-looking. How about filling in color with a net of triangles, subdivided into smaller triangles where needed for finer detail? I tried it. It looked pretty good. (You can't see the effect in these small images... remember, the originals are four and a half feet tall. But trust me. It looks pretty good.)

If I ever do more of these, I'll probably want to add more classes of object, which means more code. Like I said, hard to extend. But for this project, the tool is sufficient.

Last updated January 21, 2003.

Technical Details: Hills - Trees - Temples - Forest