You are here

Hex and Triangle grids

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
Hexgrid.jpg42.53 KB
JMS-Map_HexorTri.scm12.92 KB

This script will construct either a hexagonal or triangular grid. It's a kind-of follow-up script to the circular grid one I made a bit earlier. (If you wanted that one instead, look here: http://registry.gimp.org/node/25206)

You choose the size of the image, and the length of side of the shape. The shapes can be filled with up to six different colors, a white background, transparent, or completely random colors. There is also an option to set up the grid so that it will tile seamlessly. I've attached a picture showing a hexagonal tiling grid generated with this script.

The hexagons are regular ones, and the triangles are equilateral. The script will appear in the Filters/SambrookJM menu, but this can be changed by editing the appropriate line in the script.

I'm sure there will be lots of things I didn't even think of while making this script. Feel free to post any ideas, comments or questions you have. If I"m able to, I'll add them to the next version of the script.

------------------------

Updated script - There was an error in the script that would show up if you used less than six colors. That has been fixed now, and the new script has been updated. Still working on the uniform coloring and the anti-aliasing.

Code License: 
GIMP Version: 
Scripting Engine: 

Comments

There was a bug in this script that would appear if you chose to use less than six colors. That has been fixed, and the new version of the script has been uploaded. I'm still working on the uniform coloring and the anti-aliasing versions.

I'm trying to design a game map using a hexagonal grid with different types of terrain - is there any way to use a picture background instead of a colour fitted into each hexagon, or would that be too complicated?

Apply your background on a new layer, then either bump map it with the grid layer or simply change the layer modes to customize the grid look.

Nice script, Sam!

I must admit I like my edges to be smooth/crisp/anti-aliased. Anyway to add that option?

How would you go about setting up anti-aliasing on a brush? Would setting the hardness to a value of less than one work? Or perhaps a gaussian blur set to the brush width do the trick?

Have the script run unsharp mask on the results?

I guess I wasn't looking at the script closely enough to notice it uses brushes.

I tend to use brushes rather than free select to draw lines, since it gives the user a bit more control about how thick the lines will be. Growing and shrinking selections can lead to some odd results with weird shapes.

Still, a gaussian blur of 1 pixel does seem to give a pretty good approximation of anti-aliasing. If you want that in the script, that's a trivial addition.

Blur option is good.

Blur option is probably not the best solution. sambrookjm, I sent you an email with a version of the script; if it can help you ... ;)
- Use gimp-paintbrush-default instead of gimp-pencil.
- Add an option for gimp-brush-set-hardness
- Create an new layer for color (colorLayer)
- From the baseLayer, grow the selection with the same value as the radius of the brush (gimp-selection-grow theImage Brush_Rad) and then (gimp-edit-bucket-fill colorLayer ...

NB: I changed some lines, then reread the whole script.
for example:
(if (not (= coloredHex 1)) before the (gimp-layer-add-alpha ...

Pages

Subscribe to Comments for "Hex and Triangle grids"