Procedural hexagon tiles Blender shader

Recently I saw that someone was selling procedural hexagon tiles Blender shader. I became very curious about how this was achieved and spent couple days trying to figure this out on my own. Turns out you don’t need much more than just a bunch of math nodes and UV coordinates as an input. The rest is just basic geometry and basic math. No OSL. Works on GPU and in the viewport! Welcome to Shader Programming 101 🙂

I won’t go into details, but what I made is a node group that can generate any N-Gon. On top of that there are couple helper groups that do tiling and other things. By combining these building blocks, you can create a lot of interesting textures.

Update: Fixed some bugs, played around with other ideas. Made different node groups useful for other shader tasks – pixelating UV spaces etc.

Here is the Blender scene! Have fun and let me know if you think about any useful features this setup needs!


If you want to learn more about shader programming, I highly recommend reading this awesome and free online book – The Book of Shaders!


6 thoughts on “Procedural hexagon tiles Blender shader”

  1. Rich Sedman
     ·  Reply

    Excellent work – very nice. I’d be very interested in how you’ve achieved this as I developed a hex shader of my own a short while back and love the way complex patterns can be created out of really quite simple maths.

    • kurzemnieks
       ·  Reply

      Thanks! Well it’s basically just transforming your UV coords (tiling, rotating, scaling) + simple triganometry to create shapes from UV coordinates. You can download the file and look at the node graph.
      I recommend reading free online book I mentioned at the end of the post. I had some trouble figuring out how do do the shape itself and this chapter from the book helped me to understand the math:
      It’s quite easy to implement everything using blender nodes, because all the math operations used in shader coding are available also in Blender. Although I would still prefer code if it would be possible to do that in Blender – it’s much more readable than nodes.

  2. Rich Sedman
     ·  Reply

    That’s a really neat solution – completely different approach to my own. I see now how you can animate rotation and change of ngon, far more versatile than my own solution which is similar to how the Voronoi texture is produced – by positioning the centres of each cell and calculating the distance from each to determine the nearest. If you’re interested, take a look at

    • kurzemnieks
       ·  Reply

      That’s cool! I have not plyed with self-made voronoi shaders yet. It’s still something on my todo list 🙂

  3. markus
     ·  Reply

    no download, no code, why? bye

Leave a Reply

Your email address will not be published.