Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Procedural vector map elements -- some experiments

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Guild Journeyer gilgamec's Avatar
    Join Date
    Mar 2009
    Location
    Colonia Claudia Ara Agrippinensium
    Posts
    130

    Wip Procedural vector map elements -- some experiments

    As those who have seen my Challenge entries will know, I'm interested in creating procedurally generated maps, because:
    1. I'm far too lazy to do a map manually, and
    2. I have no artistic talent anyway.

    This thread is for showing my experiments with procedurally-generated map elements, like forests, mountains, cartouche decorations, etc. -- mostly in a hand-drawn- or engraved-style.

    First off, I'm looking at forests. I'm going to take the forest style from this tutorial as a starting point, and see how far I can get completely procedurally.

    The distribution of trees in the forest is pretty simple. I take a Poisson point distribution, drop a circle at each point, and take this as a first step.
    Sketchy-1a.png
    The actual shape of trees is going to be more irregular than just circles, of course. First, the general shape shouldn't be a circle, but more of an egg shape. I can alter a parameter and get shapes of greater or lesser egginess.
    Sketchy-1b.png
    Next, to create lobes, I'm going to make the tree silhouettes the overlap of a bunch of circles. First, I put a Poisson point distribution inside the general tree shape. Second, I put a circle around each point, then take their outside boundary as my tree boundary. (I'm not drawing all of the circles here, only the ones that actually contribute to the boundary.)
    Sketchy-1c.png
    Replacing the circles in the forest with these shapes already greatly improves the forest.
    Sketchy-1d.png

  2. #2
    Guild Journeyer gilgamec's Avatar
    Join Date
    Mar 2009
    Location
    Colonia Claudia Ara Agrippinensium
    Posts
    130

    Wip Forests part 2 -- shading the trees

    If you look back at the tutorial I'm cribbing from, you'll notice that the shading on the trees is an integral part of the overall effect. In this post, I'm talking about getting a similar effect.

    First, I tried a sort of drop-shadow effect. (Actually, the outline is stroked with a rotated elliptical nib, but the result is pretty much the same.) I don't really like it -- it looks too uniform. In the second test, I tried a different tack.

    I went back to the circles that create the outline. I want to locate the circles on the bottom left of the tree, so I shift the general tree shape (red) up and to the right; the circles whose centers are in the shifted shape (black) form the "lit" section, while the other circles (blue) are the "shaded" section.
    Sketchy-1e.png
    We can shade the trees in the forest scene and see that it's much improved.
    Sketchy-1f.png

    Another nice factor in the original tutorial is the "ground", which is hatch-shaded. I can create a similar effect with straight lines deformed a little bit by random control point rotations.
    Sketchy-1g.png

    Of course, one of the nice things about procedural generation is that I can generate this pattern at any scale and size.
    Sketchy-1h.png

  3. #3

    Default

    Great stuff!

    Will you be working on tree trunks in the next bit?

    I'm amazed, with depth of your observation as to the shape and underlying form etc, you should be able to draw with ease.

  4. #4
    Guild Artisan töff's Avatar
    Join Date
    Nov 2007
    Location
    Fresno, California USA
    Posts
    867

    Default

    Ya, they want trunks ... and that would make it a home run!

  5. #5
    Guild Journeyer gilgamec's Avatar
    Join Date
    Mar 2009
    Location
    Colonia Claudia Ara Agrippinensium
    Posts
    130

    Wip By popular demand: trunks!

    Thanks for your comments! Trunks should be pretty easy; I don't think they need any kind of wiggliness (though it wouldn't be too hard to add):
    Sketchy-1i.png
    And you're right; it improves the look considerably. Great!
    Sketchy-1j.png
    Sketchy-1k.png

    On a related note: does anyone have any suggestions for software for converting from vector (in this case, PDF) to raster images? I'm using ImageMagick here (which farms it out to Ghostscript, I think), and while it looks fine on coarser images, it does terribly on the finer detail (like the hatching); those images I've had to convert manually in Illustrator.

  6. #6
    Guild Artisan töff's Avatar
    Join Date
    Nov 2007
    Location
    Fresno, California USA
    Posts
    867

    Post

    Quote Originally Posted by gilgamec View Post
    any suggestions for software for converting from vector (in this case, PDF) to raster images
    Of course, Photoshop will rasterize vectors and PDFs. (Remember that a PDF is just a containter for vectors and/or rasters of any resolution(s) and/or type.)

  7. #7
    Guild Artisan töff's Avatar
    Join Date
    Nov 2007
    Location
    Fresno, California USA
    Posts
    867

    Default

    Home run! Maybe ...

    Can you feed a shape into your procedure, and generate complete trees within that shape? I mean, so the trees on the edges don't get cropped.

    What software are you using to generate trees with your procedure?

  8. #8
    Guild Journeyer gilgamec's Avatar
    Join Date
    Mar 2009
    Location
    Colonia Claudia Ara Agrippinensium
    Posts
    130

    Post

    Quote Originally Posted by töff
    Can you feed a shape into your procedure, and generate complete trees within that shape? I mean, so the trees on the edges don't get cropped.
    I'm not certain what you mean about edges getting cropped; I can't see any of that in the examples above. Are you talking about an arbitrary forest shape, or an arbitrary tree shape? Both should be quite possible (and the edges should never be cut off); an arbitrary tree shape would be easier than fitting exactly to an arbitrary forest shape, if only because the shapes of the trees varies more than the shapes of component circles.

    Quote Originally Posted by töff
    What software are you using to generate trees with your procedure?
    I'm using Asymptote, which is designed for making technical diagrams, but can be coerced into doing stuff like this.

    Quote Originally Posted by töff
    Of course, Photoshop will rasterize vectors and PDFs. (Remember that a PDF is just a containter for vectors and/or rasters of any resolution(s) and/or type.)
    I'm sorry, I should have been more specific; Asymptote is giving me PDF-encapsulated PostScript, which I want to rasterize in some automatic fashion. Photoshop would, of course, work; I'm currently using Illustrator (they probably use the same engine, anyway). However, this means that I have to manually load and save every time; if I could use ImageMagick for the conversion, I could just put the final rasterization into my toolchain and have it done automatically at the end.

    In the end, it's not so much of an issue, I was just hoping that someone here might have some suggestions.

    Quote Originally Posted by Koor
    Can you add a chance of a dead tree or stump being generated into the product? Also random generation of a glade or underbrush could add to the end product.
    Hmmm... Could you suggest some examples of dead trees? I'm not certain how to express that in 2D. As for underbrush, though, that might be an idea. I'll have to look at it....

  9. #9
    Guild Artisan töff's Avatar
    Join Date
    Nov 2007
    Location
    Fresno, California USA
    Posts
    867

    Post

    Quote Originally Posted by gilgamec View Post
    I'm not certain what you mean about edges getting cropped; I can't see any of that in the examples above.
    Yes but you just filled a square with trees. Can you fill a circle ... or an arbitrary forest outline that you can feed into the procedure?

    Otherwise, the user will have to generate a big square full of trees, and then cut out his forest shape, carefully not cutting any trees in half.

    I'm thinking, here I am in Photoshop or Illustrator or whatever, and I need a forest. So I draw a vector path for the forest border, copy or save it, and then fire up your tree-pattern generator and give it that vector path. Then, voila, the procedure makes me the exact forest I need, full of (uncropped) trees, which I then drop into my map.

  10. #10
    Guild Journeyer gilgamec's Avatar
    Join Date
    Mar 2009
    Location
    Colonia Claudia Ara Agrippinensium
    Posts
    130

    Post

    Quote Originally Posted by töff View Post
    Yes but you just filled a square with trees. Can you fill a circle ... or an arbitrary forest outline that you can feed into the procedure?
    Sure.
    kidney.png
    It's difficult to get a tight fit to the boundary; as I said in my last post, this is largely because trees aren't uniform in shape (so some are narrower, and thus too far away from the edge; if you account for this, the wider ones will intersect it). Also, the area I'm hatching is harder to compute (as it's no longer convex).
    Quote Originally Posted by töff
    Either way, if you want a raster, Illustrator will not give you one, except by export, which I find usually doesn't give as good results as rasterizing in Photoshop.
    I'm using Illustrator's "export for web" function. I'm still not certain that it's any worse than Photoshop's save functions; it's better for my purposes, though, because the procedure is just load-export; with Photoshop, vector images load with no background, and don't use the bounding box in the PDF, so I have to manually reposition them and add a background before saving.
    Quote Originally Posted by töff
    In Ill. & PS both, you can place linked files, which will update on file open. I'm fuzzy on your workflow toolchain, but maybe links would be the answer ... get it, chain, link?
    I hadn't thought of that; it may not be a bad idea. I'll look into it.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •