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!
Updated!: Recently I updated this to Blender 2.8 and was pleasantly surprised that It also compiles and works in Eeevee exactly as in Cycles. That’s crazy awesome, if you ask me! Based on similar ideas, I also created procedural tiles shader that works in World space (independant from UV and topology) that allows to do some cool teleportation effects!
I won’t go into details, but what I made is a node group that can generate any N-Gon. You can control rotation, scaling, distribution/tiling as well as shape edge blending. 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.
If you want to learn more about shader programming, I highly recommend reading this awesome and free online book – The Book of Shaders!