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

Thread: Random Density Map GIMP Script

  1. #1
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Info Random Density Map GIMP Script

    As hinted here I have been working on a gimp script to draw with the active brush using a "density map" to determine the probability of painting.

    Attached is a zip. Just drop it in the gimp script directory.

    Here is where it registers in the menu:
    Click image for larger version. 

Name:	menu.png 
Views:	379 
Size:	65.7 KB 
ID:	4986

    Do use it in the most basic way, create a probability density map.... a layer where back will have a 0% chance of drawing and white will have a 100% change of drawing:
    Click image for larger version. 

Name:	map1.png 
Views:	230 
Size:	63.0 KB 
ID:	4988

    Create a new layer (it must be the same size) to draw on with the current brush.

    Here is the dialog:
    Click image for larger version. 

Name:	dialog.png 
Views:	172 
Size:	15.4 KB 
ID:	4987

    and one result with a red Hexagonal 21 px brush, and set it at 100% Density, Spacing of 21 px, and no Jitter:
    Click image for larger version. 

Name:	1-nojitter.png 
Views:	153 
Size:	10.0 KB 
ID:	4989

    (more examples following...)
    Attached Files Attached Files

  2. #2
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Post

    Using the same Density map, here are more results:

    Setting the density to 50% will make white only have a 50 chance of drawing. Here again with no jitter:
    Click image for larger version. 

Name:	2-nojitter_50percent.png 
Views:	179 
Size:	8.1 KB 
ID:	4990

    And back at 100%, but with a jitter of 1. The jitter value is a scale of the spacing parameter, for randomly displacing the x&y directions, to get rid of the grid look:
    Click image for larger version. 

Name:	3-jitter.png 
Views:	167 
Size:	12.6 KB 
ID:	4991

    The scrip draws left to right and top to bottom, to work with isometric image brushes, like the trees posted:
    Click image for larger version. 

Name:	4-trees.png 
Views:	2348 
Size:	193.9 KB 
ID:	4992

    And using the "invert" check will invert the map (black = 100% chance and white = 0% chance):
    Click image for larger version. 

Name:	5-trees_invert_map.png 
Views:	584 
Size:	325.7 KB 
ID:	4993

    (cont...)

  3. #3
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Post

    The other option is less useful for mapping but might have some artistic uses...

    You can use a map with transparency, and it will use the alpha as the density map, and the colour as the colour to paint with.

    Here is such a density map:
    Click image for larger version. 

Name:	map2.png 
Views:	207 
Size:	124.9 KB 
ID:	4994

    and the result, using the hex brush again:
    Click image for larger version. 

Name:	map2_result.png 
Views:	137 
Size:	26.6 KB 
ID:	4995

    Enjoy!

    -Rob A>

  4. #4

  5. #5

    Praise

    Excellent and useful stuff.

    S. John Ross Ghalev
    Who Dat? Games Fonts Uresia

  6. #6
    Community Leader jfrazierjr's Avatar
    Join Date
    Oct 2007
    Location
    Apex, NC USA
    Posts
    2,963

    Default

    The drool is running down my chin as I type. This is GREAT. I can't wait to try it out.

    Joe
    My Finished Maps
    Works in Progress(or abandoned tests)
    My Tutorials:
    Explanation of Layer Masks in GIMP
    How to create ISO Mountains in GIMP/PS using the Smudge tool
    ----------------------------------------------------------
    Unless otherwise stated by me in the post, all work is licensed under a Creative Commons Attribution-Noncommercial 3.0 United States License.

  7. #7
    Guild Artisan su_liam's Avatar
    Join Date
    Aug 2007
    Location
    Port Alberta, Regina(IRL: Eugene, OR)
    Posts
    717

    Default

    Cool. I'll have to try this. It looks like you might be able to use the alpha-and-color option to cause interesting variation in tree(or mountain or whatever) color. For instance, with trees, create a layer with a narrow variation of green shades. (Possibly use a greyscale fractal and gradient map with a narrow gradient(say dark green to light green)).

    Another idea I have is to make an initial color layer that varies only in hue and saturation, and apply a variation in value by multiplying with the shaded relief from an HF.

    Then you paint in your desired forest density in alpha.

    Might be a good way to add an interesting forest texture to a shaded relief map.

    I was initially thinking of using top-down trees for a realistic look, but I think this might work best all symbolical, with iso trees simply as a symbol saying, "forest here."


    If nothing else, this is making GIMP look like a more and more viable alternative to CC for "symbol"-type maps.
    Last edited by su_liam; 07-07-2008 at 02:46 PM.

  8. #8
    Administrator RobA's Avatar
    Join Date
    Apr 2007
    Location
    Niagara, Canada
    Posts
    5,567

    Default

    One limitation is that it doesn't respect active brush scaling, so all images are drawn at the original scale of the selected brush. Initially, I hoped to have an options to paint smaller versions based on the density map, but dynamic brush scaling isn't exposed in the scripting API (yet).

    -Rob A>

  9. #9
    Guild Artisan Facebook Connected
    Join Date
    May 2008
    Location
    Atlanta, Georgia, United States
    Posts
    928

    Post

    Oh my... this is very cool... an excellent tool!

  10. #10
    Community Leader Torq's Avatar
    Join Date
    Jun 2007
    Location
    Cape Town, South Africa
    Posts
    902

    Post

    I agree. Great tool Rob, I'm going to try it as soon as possible.

    Torq
    The internet! It\'ll never catch on.

    Software Used: Terranoise, Wilbur, Terragen, The Gimp, Inkscape, Mojoworld

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
  •