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

Thread: Random Density Map GIMP Script

Hybrid View

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

    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:	399 
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:	239 
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:	184 
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:	165 
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,572

    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:	187 
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:	175 
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:	2359 
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:	596 
Size:	325.7 KB 
ID:	4993

    (cont...)

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

    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:	215 
Size:	124.9 KB 
ID:	4994

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

Name:	map2_result.png 
Views:	146 
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
    770

    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 01:46 PM.

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

    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 Adept Seraphine_Harmonium's Avatar
    Join Date
    Apr 2011
    Location
    Poughkeepsie, NY USA
    Posts
    387

    Default

    This is a great idea. I noticed though, that you have trees in various colors. How do you get this to happen?

    When I first tried to use this, I was using transparent brushes, which I have found doesn't work if the density is greater than the very sparse. I ended up layering color behind one, merging down, and making a brush from the clipboard, but the trees all look identical that way. In your example there is at least color variance. Is this a difference in how I am implementing the script, or did you recolor them afterwards?

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

    Default

    Quote Originally Posted by Seraphine_Harmonium View Post
    This is a great idea. I noticed though, that you have trees in various colors. How do you get this to happen?

    When I first tried to use this, I was using transparent brushes, which I have found doesn't work if the density is greater than the very sparse. I ended up layering color behind one, merging down, and making a brush from the clipboard, but the trees all look identical that way. In your example there is at least color variance. Is this a difference in how I am implementing the script, or did you recolor them afterwards?
    My guess is he used an animated brush in the first place...ie a .gih brush with multiple brush images, similar to .gif
    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.

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
  •