Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: [Award Winner] Using the mosaic filter to make towns in Gimp

  1. #1
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Tutorial [Award Winner] Using the mosaic filter to make towns in Gimp

    Now this has certainly been done before but I've been playing around and trying to get a good town result in Gimp using the mosaic filter and I think I've ended up with something rather nice. Here's the end result:

    Click image for larger version. 

Name:	villageFinal.jpg 
Views:	1894 
Size:	180.7 KB 
ID:	7659

    and a variation with a few tricks applied:

    Click image for larger version. 

Name:	villageFinal2.jpg 
Views:	936 
Size:	171.9 KB 
ID:	7670

    I'll go through the steps I took to get this in the following tutorial.
    Last edited by torstan; 11-10-2008 at 07:30 PM.
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  2. #2
    Community Leader Facebook Connected Ascension's Avatar
    Join Date
    Jun 2008
    Location
    St. Charles, Missouri, United States
    Posts
    8,325

    Post

    This looks pretty promising. PS has a similar filter and with a lil tweaking you should be able to do this pretty darn easy. I'd like to see the process as I've never actually tried it, only thought about it. Nice job.
    If the radiance of a thousand suns was to burst at once into the sky, that would be like the splendor of the Mighty One...I am become Death, the Shatterer of worlds.
    -J. Robert Oppenheimer (father of the atom bomb) alluding to The Bhagavad Gita (Chapter 11, Verse 32)


    My Maps ~ My Brushes ~ My Tutorials ~ My Challenge Maps

  3. #3
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post

    Thanks - obviously that is a somewhat extreme example, and it may well be that it is best used for smaller regions as that looks a little overwhelming, but the sense of buildings seems to work there. Anyway, on with the tutorial.

    1. Lay out your roads
    Create a new transparent layer (shift-click the new layer button on the layers dialogue). Call the layer Roads.

    First things first. Lay out the areas that will form your roads. Do this with a nice large brush (your actual roads will be a little smaller than these). Your image should look something like this:

    Click image for larger version. 

Name:	villageRoads.jpg 
Views:	445 
Size:	55.6 KB 
ID:	7663

    2. Get some colours for your roofs
    Now we want some nice variation in the colours of the roofs of the buildings. No town looks any good with uniform roof colours. What we will do here is create a solid colour layer that will be used by the mosaic layer as the base for the buildings further down the line. So if you want one district to have blue roofs - make sure that area is blue here.

    I want to have roofs with a wide variety of browns in the roof colours. To this end I create a new layer and call it colours. I then take the brush tool and make sure that the opacity sensitivity for my tablet is off. I want the whole layer to be opaque so that the roofs that are generated are opaque. Now I pick the Use colour from gradient option and pick the Browns gradient from the drop down. I then colour in the whole map with random colours. If you want colour variations that are less random - this is the place to make sure they are in the right place. You should now have something like this:

    Click image for larger version. 

Name:	colours.jpg 
Views:	438 
Size:	127.7 KB 
ID:	7664

    [b]3. Using the mosaic filter[b]
    Now we are ready for the crux of the process, using the mosaic filter. Make sure you have your Colours layer selected and go to Filters->Distorts->Mosaic. Now what you put in here will affect the shape and size of your buildings. Play around with either Octagons and squares, and squares and adjust the neatness slider and see what the results look like. Of course, adjust the size slider too to fit the size you want your final buildings to be. The other settings I would set to the values shown here because they give flat coloured tiles with white gaps between which we will need later.

    Here are the settings I use:
    Click image for larger version. 

Name:	mosaic.jpg 
Views:	235 
Size:	58.0 KB 
ID:	7665

    This will now give you a layer that we'll use later as the base of the colour for our buildings.

    4. Creating a mask
    First of all duplicate the layer Colours and rename it (I've called it streets in my example, but building mask would probably be more appropriate). Now go to Colours->Desaturate. The various options don't really matter here. Next go to Colours->Threshold. Now you'll see that our lovely mosaic pattern has suddenly gone very black and white. Play around with the location of the threshold value until you are happy with the density of the buildings. I left it so there were a couple of holes in the pattern, but not too many.

    Click image for larger version. 

Name:	Threshold.jpg 
Views:	332 
Size:	317.4 KB 
ID:	7666

    Now we need to cut out the roads from this as we do not want buildings on our roads - or even half on the roads. So first move the roads layer above the rest and select the magic wand tool with 'select merged' checked, like this:

    Click image for larger version. 

Name:	CuttingRoads.jpg 
Views:	207 
Size:	285.2 KB 
ID:	7667

    Okay, I'll carry on from here tomorrow.
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  4. #4
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post

    Now, set the threshold to 0 - this is important as otherwise you'll end up with some slightly transparent buildings. Click the magic wand on the road and you'll get a selection that encompasses the road and all the houses that are adjacent to it.

    Now make sure the black and white mosaic layer is selected and go to Edit->Fill with Background colour to fill the selection with white (or ctrl-. for quick).

    Do not get rid of the selection, we want to put some of those buildings back in again.

    You should now have something like this:

    Click image for larger version. 

Name:	noHouses.jpg 
Views:	304 
Size:	311.8 KB 
ID:	7686

    To replace some of those houses we need a little bit of trickery. Take the following steps:
    1. Make sure the Roads layer is selected.
    2. Go back to the magic wand and deselect the Sample Merged option.
    3. Change the selection preferences to Subtract from Selection.

    Your tools window should now look like this:

    Click image for larger version. 

Name:	MagicWand.jpg 
Views:	180 
Size:	27.0 KB 
ID:	7687

    Now click on the black road. Now you just have the white space selected where you want to replace buildings. However this still borders the road, so if we just fill that with black then we'll be back where we started. To get around this do the following.
    1. Go to Select->Shrink... and shrink your selection by 2 pixels, leave all other options at their default.
    2. Go to Select->Grow... and grow by one pixel.

    This has the effect of getting rid of tiny areas and retaining larger ones.

    3. Make sure your black and white mosaic layer is selected.
    4. Go to Edit->Fill with Foreground colour (or ctrl-, for quick).

    You should now have something that looks like this:

    Click image for larger version. 

Name:	edgingHouses.jpg 
Views:	298 
Size:	208.0 KB 
ID:	7688

    Essentially we are now done, having created a mask that has all of our houses in it. Now the challenge is to make this pretty. I'll address this in the next post.
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  5. #5
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post Making it pretty

    Now we'll go back to that colour layer we left alone. First of all, we want to get rid of all the blocks of colour that represent houses that we no longer need.
    1. Make sure your black and white mosaic layer is selected.
    2. Select all (ctrl-a).
    3. Copy (ctrl-c)
    4. Select your colour layer.
    5. Right click the colour layer in the layers dialogue and select Add Layer Mask...
    6. Click okay in the dialogue
    7. Select the layer mask in the layers dialogue.
    8. Paste (ctrl-v) and anchor the pasted layer to the layer mask (click the little anchor at the bottom of layers dialogue).

    Now the layer mask is the wrong way round at the moment - it is masking out the buildings and only revealing the white between. With the layer mask selected, go to Colours->Invert. You'll now have the mask the right way round. If you move the colours layer to the top of your layer stack you should now see something like this:

    Click image for larger version. 

Name:	colours2.jpg 
Views:	289 
Size:	293.4 KB 
ID:	7689

    This is all very well, but the houses are just flat blocks of colour at the moment. We want to give them some substance. To do this, take the following steps.
    1. Duplicate the black and white mosaic building mask layer and rename it something like "Building Bump Map"
    2. Go to Colours->Invert to make the streets black and the buildings white. Remember, bump mapping takes white points to be the highest and black points to be the lowest, so we want the streets to be the lowest point.
    3. Change to the Select by Colour Tool with threshold set to zero, and click on one of the white buildings to select all the buildings.

    You should now have something that looks like this (note that I've turned off the visibility of the other layers so that I can see what I'm doing):

    Click image for larger version. 

Name:	SelectByColour.jpg 
Views:	242 
Size:	290.6 KB 
ID:	7690

    4. Switch to the gradient tool.
    5. Select the Shaped Angular option in the Shape drop down.
    6. Check the switch direction checkbox beside the Gradient: drop down
    7. Click and drag inside one of your selected buildings to fill all of them with a shaped gradient.
    8. Edit->Select None (ctrl-shift-a) to see your handiwork.

    It should now look something like this:

    Click image for larger version. 

Name:	gradient.jpg 
Views:	252 
Size:	211.1 KB 
ID:	7691

    This is now ready for use as a bump map.

    9. Turn off the visibility of this layer and select your Colours layer again.
    10. Right click the layer in the layers dialogue->Apply Layer Mask
    11. Go to Filters->Map->Bump Map...
    12. In the Bump Map dialogue make sure that your Building Bump Map layer is selected as the bump map.
    13. Play with the Depth slider until the preview looks good.

    Here are the settings I used:

    Click image for larger version. 

Name:	bumMapDialogue.jpg 
Views:	123 
Size:	55.0 KB 
ID:	7692

    14. Now click okay and you should have something like this:

    Click image for larger version. 

Name:	houses.jpg 
Views:	273 
Size:	214.7 KB 
ID:	7693

    In the next section we'll look at putting in a background and some finishing touches.
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  6. #6
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post Adding in a background

    Now we'll put in some colour to finish the whole thing off. First of all, let's put in some grass background.

    1. Create a new layer
    2. Place it under your Colours layer and your Roads layer
    3. Fill it with a nice grass texture (select a grass texture and then hit ctrl-.

    Now it will look something like this - its starting to come together:

    Click image for larger version. 

Name:	withGrass.jpg 
Views:	360 
Size:	263.1 KB 
ID:	7694

    We also want roads that aren't black lines. For this take the following steps:
    1. Create a new layer and call it Street Colour
    2. Fill it with a nice street texture - I've found that the default Gimp pattern Slate is actually not too bad as a starting point.

    Now this makes everything grey - we don't want that. We want to create a layer mask that will show only the areas we want.
    3. Right click Street Colour in the layers dialogue and go to Add Layer Mask...
    4. Select Black - full transparency in the Layer Mask Dialogue.
    5. Select your Roads layer.
    6. Select the Magic Wand tool and make sure the selection mode is Replace Current Selection
    7. Click on the road to select all your roads (if you have disconnected road sections it is better to use the Select by Colour Tool here instead).

    You should now have something that looks like this:

    Click image for larger version. 

Name:	roadsSelection.jpg 
Views:	213 
Size:	287.3 KB 
ID:	7695

    8. Select the layer mask for the Street Colour layer in the layers dialogue
    9. Go to Select->Shrink and pick 2 pixels
    10. Fill the selection with white.
    11. Edit->Select none (ctrl-shift-a).

    Now this gives a very hard edged road network. I personally think this is a little too clean. To fix this, still with the layer mask selected, do the following:
    12. Go to Filters->Blur->Gaussian blur
    13. Accept the defaults and hit okay.

    You should now have something that looks like this:

    Click image for larger version. 

Name:	withRoads.jpg 
Views:	188 
Size:	173.6 KB 
ID:	7696

    Now the roads are a bit dark, so I used the Colours->Brightness/Contrast dialogue to up the brightness of the roads a bit:

    Click image for larger version. 

Name:	withRoads2.jpg 
Views:	195 
Size:	177.7 KB 
ID:	7697
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  7. #7
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post Adding som shadows

    Okay, so now we want to add some shadows.

    1. Go back to your black and white buildings layer
    2. Use the Select By Colour Tool to get a selection of all the buildings
    3. Go to Filters->Light and Shadow->Drop Shadow
    4. Pick the following options in the dialogue:

    Click image for larger version. 

Name:	dropShadow.jpg 
Views:	241 
Size:	20.9 KB 
ID:	7698

    5. Hit okay and move the layer under your Colours Layer

    That's it done. The town is finished and the houses are all there. My final screen looks like this:

    Click image for larger version. 

Name:	finalScreen.jpg 
Views:	133 
Size:	283.6 KB 
ID:	7699

    and the final map looks like this

    Click image for larger version. 

Name:	villageFinal3.jpg 
Views:	524 
Size:	176.8 KB 
ID:	7700

    Now there are lots of things that can be done to tweak this process - if you fiddle with the settings in the mosaic filter specifically you will be able to get more or less spaced out houses and different shapes. Equally you can posterise the colours layer and apply a stroke to the houses to make it look more hand drawn. Here I also put all the colour layers over a parchment background and changed them to multiply, overlay, or hard light, to get a less intense feel. I added an overlay layer with some broad regions of light and dark for the hills. I also used the bump map layer as an overlay layer to give a bit more light and shade to the buildings.

    Click image for larger version. 

Name:	final5.jpg 
Views:	354 
Size:	164.4 KB 
ID:	7704

    Here's the layer layout for that map:

    Click image for larger version. 

Name:	finalScreen5.jpg 
Views:	154 
Size:	271.5 KB 
ID:	7702
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  8. #8
    Guild Adept bryguy's Avatar
    Join Date
    Jul 2008
    Location
    In my own little world =D
    Posts
    289

    Post

    love the tutorial! and I think that the random village shapes look cool




    btw, what did you do for that last pic? it looks awesome
    "When I use a word," Humpty Dumpty said in a rather scornful tone," it means just what I choose it to mean -- neither more nor less."
    "The question is," said Alice, "whether you can make words mean so many things."

    "The question is," said Humpty Dumpty, "which is to be master -- that's all."


    -Lewis Carrol: Through the Looking Glass

  9. #9
    Community Leader Facebook Connected torstan's Avatar
    Join Date
    Jul 2007
    Posts
    4,162

    Post

    I'm glad you liked it. I'd urge all that read through it to rate it, if you like it or not.

    The steps I took to make it look pretty are:
    1. Add a parchment texture as the background.
    2. Change the layers above in the following way:
    a. Duplicate the layer
    b. Set the blend mode of the bottom of the two copies to overlay
    c. Reduce the opacity of the top layer to between 50-80% depending on the result

    This softens the colours and blends the colour scheme together a little more. Now to create some light and dark regions:

    3. Create a new layer over the map and set the mode to overlay.
    4. Fill with precisely 50% grey (you will see no effect at this stage as 50% grey does nothing for overlay layers. Don't worry, it will be important later).
    5. Go to the dodge/burn tool and take a nice large fuzzy brush. Make sure you have the tool set to burn and the range set to shadow:
    Click image for larger version. 

Name:	DodgeBurn.jpg 
Views:	171 
Size:	34.2 KB 
ID:	8163
    6. Now run the brush over those regions that you would like to be dark - essentially hill-sides away from your sun.
    7. Now switch to dodge, and set the range to midtones.
    8. Run the brush over those regions that are in the light - hill tops and the sides of hills facing the sun.

    You will now have soft highlights and shadows on your map. This will give the impression of hills. Repeat these steps to get deeper shadows and feel free to use the smudge tool with a large fuzzy brush to smooth out any shadows that are too dark.

    If you set your overlay layer to normal you'll see that you've really got a grey layer with lighter and darker regions on it. For the map above, my overlay layer looks like this:
    Click image for larger version. 

Name:	overlay.jpg 
Views:	593 
Size:	19.1 KB 
ID:	8164

    That's all there is to it.

    I've also uploaded the .xcf file in a zip for people who want to see the breakdown of all the layers and blending modes for that final image. I hope its useful!

    village2.zip
    Fantasy Map Blog | My food illustration
    Everything I post is free for use and redistribution under the Creative Commons Attribution-Noncommercial-Share Alike 3.0 licence, except where noted otherwise in the thread.

  10. #10
    Guild Journeyer Sagenlicht's Avatar
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    249

    Post Nice

    Nice tutorial torstan

    Repped and rated
    My Map Challenge Entries

    I use GIMP for all my maps.

    GIMP scripts and plug-ins overview


    Everything I post on this site uses the Creative Common Attribution-Noncommercial-Share Alike license. Only exception to this are any pyhton scripts which use the GPL.

    If you are using any of my posted stuff just use your rep stick on me

    Should you be interested in using anything I posted on commercial purpose drop me a pm.

Tags for this Thread

Posting Permissions

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