Hexagonal Patten

Hi, I am trying to create a wallpaper with random hexagonal sizes and colours. I have this now with Geometry nodes. How do I create a pattern without these gaps and give different colours to each? Thanks.

Edit 1: When I used Random value for scale, I got different sizes. But still to figure out how to give different colours to each hexagon.

Store a named attribute per-Instance with the colour, and then read that attribute by the same name in the material nodegraph.

1 Like

Not sure why the colour is black for me. Also, is it possible to choose a set of colours only than a wide range of colours? Thanks

You spelled it mycolor in the geonodes and mycolour in the shader.

You can store anything you want, I just showed a minimum viable example.

1 Like

Regret the error, fixed it. It is white now though

See how the smallest ones are actually grey? You’re using the same seed for both random number genrators, so you’re going to get corresponding results. You’re also using a single value from 0 to 2.8 as a colour, a datum which expects a value from 0 to 1, so the average value is 1.4 which is very white.

Experiment. Make theories and suss out why they do or do not work. Look up other colour tandomization techniques and combine them.

1 Like

You posed an interesting question that got me thinking about hexagonal grids.

The centers of a hexagonal grid describe a grid of equilateral triangles. We can use the Dual_Mesh node to convert one to the other.

Start with a Mesh_Line, and extrude the edges, zig-zagging left/right every other row. With simple trigonometry, you can get these points to describe a grid of equilateral triangles. The small spheres in the above image are the points of the triangular grid… included just to see what’s happening.

The zig-zag extrude leaves us with rhomboidal faces, so the Triangulate node is needed to chop these into the desired equilateral triangles. Taking the Dual_Mesh of this gives us a perfect Hexagonal grid mesh. Note that we lose incomplete hexagons all the way around, so the requested X * Y Counts are both reduced by 2.

In the appended .blend file (gn.31.hexagonalGrid.blend), the object to look at is cleverly named “HexagonalGrid”. It has an associated geomNodes group also named “HexagonalGrid”. You can turn off the spheres (dots) by setting “Point Radius” to zero (0).

But you asked for randomized hexagon sizes.

In the same file, look at object “HexagonalGridRandom”. The changes to the 1st geomNodes group are framed in green.

gn.31.hexagonalGrid.blend (1.2 MB)

Thanks for asking an interesting question! :smiley:

2 Likes