Hex Grid

john's Avatar

john

01 Jun, 2018 09:23 AM

Attached is an alternative to the grid node that creates hexagonal grids: hexgrid.

The hexgrid subnetwork takes 3 parameters: columns, rows, and radius. Columns and rows work just like the grid node to define the layout of the hexagonal grid, though here the "rows" snake up and down. Radius defines the radius of the hexagonal cell around each point in the grid. So instead of setting an overall width and height as in the grid node, you set the cell size and the overall grid will grow or shrink accordingly.

If you attach the output of hexgrid to a polygon with Sides set to 6 and a Radius matching the value defined in hexgrid, then colorize that polygon with a non-zero stroke and empty (white or alpha zero) fill, you will have a sheet of hexagonal graph paper. If you make your polygon radius smaller you will create an empty border around each hexagon. Or you could place other shapes in each cell to create many interesting effects.

The attached demo network shows one simple use: a hexagonal color wheel. The hexgrid node is at the top set to 16 columns and 16 rows for a total of 256 cells. I first sort the output using Angle to Point, then feed those positions into a 6-sided polygon node to create the hexagons. I color them with a hue from 0 to 255 and add hue numbers inside each hexagon to create a color chart.

If you wish to create a display with skinnier or fatter hexagons, just take the final output and scale it. I provide a scale node at the bottom of the demo network for you to play with. You can also change the radius of polygon node, change the three parameters in the hexgrid node, etc. Increasing the number of cells will make a more high-res color chart.

Special thanks to Lucas who suggested one approach to generating this grid: skewing a normal grid and then taking a rectangular subset. I haven't seen his hexgrid but thought it would be fun to make my own using this approach. You can inspect hexgrid to see how I did this.

Enjoy!

John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • Hexgrid_Screenshot.png 911 KB
  • hex_grid.zip 2.19 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

10 Dec, 2018 01:47 PM
05 Dec, 2018 09:37 AM
02 Dec, 2018 07:40 AM
29 Nov, 2018 07:38 AM
20 Nov, 2018 11:21 PM