Wednesday, February 1, 2017

Or Maybe Not, Let's Try Again

In my last posting I developed the routine that generated a smooth sequence from high peaky mountains down to low curvy hills:
I'm going to try to avoid the mistake I made last time around of not looking at these on the map until too late, so I need to add some basic capabilities to put these on a map: masking out the background, scaling and translating, and perhaps simple shading.

Masking is fairly straightforward -- I just need to take the outline of the mountain, connect it across the bottom and fill that with the background color.  It's also good to add a little buffer at the bottom of the mountain so that another mountain "behind" the front mountain doesn't peek out.  To test this I need to fill with a color different than the background.
That seems to be working.  The funny little bulge at the bottom right of each mountain is where the outline turns a corner.  I'm using a line-drawing routine that tries to draw smooth curves, so that right angle turn becomes that little bulge.

So far I've just been drawing the mountain outlines at their final size.  Instead, I need to draw them all at a fixed size and then use a scaling transform to make them their final sizes:
Here I've run into one of the problems with scaling this way:  The line width also gets scaled.  If all the mountains are close to the same size it isn't as obvious.
But it's still something I need to address.  The solution is to make the lines thicker as the mountains get smaller, although it turns out that a strict scaling looks "wrong":
At the smaller sizes, the line looks too fat.  So you have to scale the scaling :-).  I find an additional scaling of 1.5 to 2 looks okay:
YMMV -- this is largely a matter of taste.  Another problem I notice here is that the ratio of height to width is okay at the beginning, but too tall at the end.  So I'll adjust the width to get bigger as the mountains get smaller.
Okay, that looks like a pretty decent progression to my eye.  Time to try it on a map.
Too many small hills and no tall mountains (looks like frothy bubbles!), but not bad for a first attempt.  Some tweaking:
That's better, but generating maps with these settings it quickly becomes clear that the transition from tall, peaky concave mountains to broad convex mountains never looks very good.  The convex mountains tend to look much bigger than their concave counterparts.
Since the whole point of this approach is to have a seamless transition from high mountains to low hills, this is not good.  Not only is the perceived size wrong, stylistically there's an abrupt change in the character of the mountains.

Not good.

So back to the (literal) drawing board.  I spent some time doodling examples, and I decided that the (one?) problem is that all the mountain elements change over the sequence from mountain to low hill.  I need to keep at least some elements the same over the course of the sequence so that there's a visual consistency.  I like the curved feet of the low hills, so I decided to try a sequence that maintains that element.  This is the result:

This sequence does seem to have more end-to-end consistency.   Let's see how it looks on a map:
This still needs some tweaking, but that looks visually more consistent than the original sequence.

Another possibility is to go from straight to curved on both ends of the mountain contour, like this:
This is sort of a "melting" sequence from high to low, which is nice.  Here's how it looks on the map:
That also seems pretty good to me.

This project has been a lot of "two steps forward, one step backwards."  I often leave out big chunks of failed development (because I think it would be largely boring) but in this case I hope you're enjoying the journey as much as the destination.  I think the added challenge of making the result artistic adds some interest to the usual challenge of figuring out the implementation.

1 comment:

  1. To be honest, I kind of like the style in your initial map test in this post; whatever you do, don't throw the code away!

    ReplyDelete