Blender procedural hexagon pattern

I needed a texture for a hexagonal pattern that was fully procedural. In the past I wrote one in Open Shading Language but I wanted one that utilized the GPU and worked for Eevee as well. So I implemented a node group that uses basic nodes only. An example is shown below.



The node group is straight forward to use and has options to change the scale and the width of the line. An usage example is shown in this noodle:


Availability


It is available for download from my GitHub repository. To append the node group so that you can use it in your material, simply select File -> Append ..., browse to the .blend file you downloaded and locate the Hex Nodegroup. After that you can use it in the Shader editor with Node -> Group -> Hex

Implementation details


The Hex nodegroup simply overlays three 60° rotated copies of a pattern of dashed stripes


Each dash is the side of a hexagon. The stripes are created with another node group shown below (click to enlarge)


It contains two almost identical frames: one to produce a set of vertical dashes and another one to create a simlar set but offset in the x and y direction. The dashes are generated each time from a wave texture in the x direction that is combined with a greater than node to produce narrow vertical lines. From this we subtract broader horizontal lines generated in the same fashion to create the gaps between the dashes.

6 comments:

  1. Thank you for the file. What version of Blender is this for? I tried loading it with 2.82 but only got diagonal stripes.

    ReplyDelete
    Replies
    1. I don't remember exactly but I think 2.81. But I just downloaded the .blend again and opened it in 2.83.2 and that works fine, both in eevee and cycles ...

      Delete
  2. Thank you for the info I'll give 2.83.2 a try.

    ReplyDelete
  3. Thanks again. It works perfect in 2.83.2!

    ReplyDelete
  4. This is exactly what I was looking for, thank you!

    ReplyDelete