Skip to main content

Face Hexagons Grid

OCCT category icon with a stylized logo representation

Learn how to create hexagonal face patterns that respond to a control point. Hexagons closer to the control point become larger, while distant ones become smaller, creating organic wave-like effects.

Key Concepts

  • Control Point: A point that influences the hexagon sizes based on distance
  • Distance Scaling: Hexagons scale up/down based on how far they are from the control point
  • UV Coordinates: Position the control point using 0-1 values instead of exact coordinates
  • Pattern Filtering: Selectively remove some hexagons to create openings
Bitbybit Platform

Creating face from wire

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"ad44930c8195910f": {
"id": "ad44930c8195910f",
"name": "bitbybit.math.numberSlider",
"customName": "width",
"data": {
"options": {
"min": 5,
"max": 20,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 16.5
},
"inputs": {},
"position": [
429.0393216527848,
1082.0251674594201
]
},
"45d60b87e0a0dfe4": {
"id": "45d60b87e0a0dfe4",
"name": "bitbybit.math.numberSlider",
"customName": "heigt",
"data": {
"number": 9
},
"inputs": {},
"position": [
425.09924690643385,
1237.0805987593171
]
},
"4c96351a40ef58d6": {
"id": "4c96351a40ef58d6",
"name": "bitbybit.math.numberSlider",
"customName": "subdivisions w",
"data": {
"options": {
"min": 5,
"max": 40,
"step": 1,
"width": 350,
"updateOnDrag": false
},
"number": 29
},
"inputs": {},
"position": [
418.6444537944787,
1401.327026548878
]
},
"fc0f10f55cfd78c2": {
"id": "fc0f10f55cfd78c2",
"name": "bitbybit.math.numberSlider",
"customName": "subdivisions h",
"data": {
"options": {
"min": 0,
"max": 40,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 29
},
"inputs": {},
"position": [
420.87238961044295,
1553.8214401409848
]
},
"6d7ccba935d50289": {
"id": "6d7ccba935d50289",
"name": "bitbybit.point.hexGridScaledToFit",
"customName": "hex grid scaled to fit",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 10,
"height": 10,
"nrHexagonsInWidth": 10,
"nrHexagonsInHeight": 10,
"flatTop": true,
"extendTop": false,
"extendBottom": false,
"extendLeft": false,
"extendRight": false,
"centerGrid": true,
"pointsOnGround": true
},
"inputs": {
"width": {
"connections": [
{
"node": "ad44930c8195910f",
"output": "result",
"data": {}
}
]
},
"height": {
"connections": [
{
"node": "45d60b87e0a0dfe4",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInWidth": {
"connections": [
{
"node": "4c96351a40ef58d6",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInHeight": {
"connections": [
{
"node": "fc0f10f55cfd78c2",
"output": "result",
"data": {}
}
]
}
},
"position": [
1228.6706775196694,
464.9599084442343
]
},
"7b0ab71fb1f37ec8": {
"id": "7b0ab71fb1f37ec8",
"name": "bitbybit.json.getValueOnProp",
"customName": "get value on prop",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"property": "centers"
},
"inputs": {
"json": {
"connections": [
{
"node": "6d7ccba935d50289",
"output": "result",
"data": {}
}
]
}
},
"position": [
1630.8940177883746,
464.77851777398433
]
},
"d040fd68bc78c1cc": {
"id": "d040fd68bc78c1cc",
"name": "bitbybit.point.distancesToPoints",
"customName": "distances to points",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"startPoint": {
"connections": [
{
"node": "e3e97d1a757cfadc",
"output": "result",
"data": {}
}
]
},
"endPoints": {
"connections": [
{
"node": "7b0ab71fb1f37ec8",
"output": "result",
"data": {}
}
]
}
},
"position": [
2466.435030881331,
224.36748166490298
]
},
"ba7f7e91dd75c55d": {
"id": "ba7f7e91dd75c55d",
"name": "bitbybit.vector.max",
"customName": "max",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"vector": {
"connections": [
{
"node": "d040fd68bc78c1cc",
"output": "result",
"data": {}
}
]
}
},
"position": [
2932.748806773879,
486.8563013473016
]
},
"c71bfe07b38e41f9": {
"id": "c71bfe07b38e41f9",
"name": "bitbybit.vector.min",
"customName": "min",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"vector": {
"connections": [
{
"node": "d040fd68bc78c1cc",
"output": "result",
"data": {}
}
]
}
},
"position": [
2936.335250319339,
225.2391480706185
]
},
"e09dbe00c352ccd0": {
"id": "e09dbe00c352ccd0",
"name": "bitbybit.math.remap",
"customName": "remap",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"number": 0.5,
"fromLow": 0,
"fromHigh": 1,
"toLow": 0.211,
"toHigh": 0.9
},
"inputs": {
"fromHigh": {
"connections": [
{
"node": "ba7f7e91dd75c55d",
"output": "result",
"data": {}
}
]
},
"fromLow": {
"connections": [
{
"node": "c71bfe07b38e41f9",
"output": "result",
"data": {}
}
]
},
"number": {
"connections": [
{
"node": "4451d9707782e77e",
"output": "result",
"data": {}
}
]
}
},
"position": [
3388.229444402424,
181.6348369460197
]
},
"4451d9707782e77e": {
"id": "4451d9707782e77e",
"name": "bitbybit.lists.flatten",
"customName": "flatten",
"data": {
"nrLevels": 1
},
"inputs": {
"list": {
"connections": [
{
"node": "d040fd68bc78c1cc",
"output": "result",
"data": {}
}
]
}
},
"position": [
2938.4179420951496,
14.356319078361025
]
},
"e1fcbf08c74d2039": {
"id": "e1fcbf08c74d2039",
"name": "bitbybit.json.parse",
"customName": "parse",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"text": "[true, true, true, true, false]"
},
"inputs": {},
"position": [
4181.572933865546,
1697.8419602693875
]
},
"16d3131b4a0a16da": {
"id": "16d3131b4a0a16da",
"name": "bitbybit.occt.shapes.face.hexagonsInGrid",
"customName": "hexagons in grid",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 10,
"height": 10,
"nrHexagonsInWidth": 10,
"nrHexagonsInHeight": 10,
"flatTop": true,
"extendTop": false,
"extendBottom": false,
"extendLeft": false,
"extendRight": false
},
"inputs": {
"width": {
"connections": [
{
"node": "ad44930c8195910f",
"output": "result",
"data": {}
}
]
},
"height": {
"connections": [
{
"node": "45d60b87e0a0dfe4",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInWidth": {
"connections": [
{
"node": "4c96351a40ef58d6",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInHeight": {
"connections": [
{
"node": "fc0f10f55cfd78c2",
"output": "result",
"data": {}
}
]
},
"scalePatternWidth": {
"connections": [
{
"node": "188edaa55cc48f55",
"output": "list",
"data": {}
}
]
},
"scalePatternHeight": {
"connections": [
{
"node": "188edaa55cc48f55",
"output": "list",
"data": {}
}
]
},
"inclusionPattern": {
"connections": [
{
"node": "e1fcbf08c74d2039",
"output": "result",
"data": {}
}
]
}
},
"position": [
4601.643014193374,
1179.7801930070877
]
},
"6817a3e119b8001e": {
"id": "6817a3e119b8001e",
"name": "bitbybit.occt.shapes.face.createRectangleFace",
"customName": "rectangle face",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"width": 1,
"length": 2,
"center": [
0,
0,
0
],
"direction": [
0,
1,
0
]
},
"inputs": {
"width": {
"connections": [
{
"node": "ad44930c8195910f",
"output": "result",
"data": {}
}
]
},
"length": {
"connections": [
{
"node": "45d60b87e0a0dfe4",
"output": "result",
"data": {}
}
]
}
},
"position": [
1233.1555294494865,
66.5092462243021
]
},
"e3e97d1a757cfadc": {
"id": "e3e97d1a757cfadc",
"name": "bitbybit.occt.shapes.face.pointOnUV",
"customName": "point on uv",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"paramU": 0.5,
"paramV": 0.5
},
"inputs": {
"shape": {
"connections": [
{
"node": "6817a3e119b8001e",
"output": "result",
"data": {}
}
]
},
"paramU": {
"connections": [
{
"node": "70bbd4e213abbcaf",
"output": "result",
"data": {}
}
]
},
"paramV": {
"connections": [
{
"node": "75479b9084987307",
"output": "result",
"data": {}
}
]
}
},
"position": [
1804.7348160741294,
-345.33507323009553
]
},
"70bbd4e213abbcaf": {
"id": "70bbd4e213abbcaf",
"name": "bitbybit.math.numberSlider",
"customName": "u1",
"data": {
"options": {
"min": 0,
"max": 1,
"step": 0.01,
"width": 350,
"updateOnDrag": false
},
"number": 0
},
"inputs": {},
"position": [
482.238253954552,
-303.0919535070989
]
},
"75479b9084987307": {
"id": "75479b9084987307",
"name": "bitbybit.math.numberSlider",
"customName": "v1",
"data": {
"options": {
"min": 0,
"max": 1,
"step": 0.01,
"width": 350,
"updateOnDrag": false
},
"number": 0.49
},
"inputs": {},
"position": [
477.9973898770159,
-143.21421959629308
]
},
"188edaa55cc48f55": {
"id": "188edaa55cc48f55",
"name": "bitbybit.lists.createList",
"customName": "create list",
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "e09dbe00c352ccd0",
"output": "result",
"data": {}
}
]
}
},
"position": [
3774.1237260005505,
222.0353306345227
]
},
"7b30d93ddc67215e": {
"id": "7b30d93ddc67215e",
"name": "bitbybit.vector.add",
"customName": "add",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"first": {
"connections": [
{
"node": "e3e97d1a757cfadc",
"output": "result",
"data": {}
}
]
},
"second": {
"connections": [
{
"node": "8a9746568185ff05",
"output": "result",
"data": {}
}
]
}
},
"position": [
2808.986525228427,
-469.65148540833
]
},
"8a9746568185ff05": {
"id": "8a9746568185ff05",
"name": "bitbybit.vector.vectorXYZ",
"customName": "vector xyz",
"async": false,
"drawable": true,
"data": {
"genericNodeData": {
"hide": true,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"x": 0,
"y": 3,
"z": 0
},
"inputs": {},
"position": [
2407.7419693212737,
-248.19410922127568
]
},
"52c7bcb502b29908": {
"id": "52c7bcb502b29908",
"name": "bitbybit.occt.dimensions.pinWithLabel",
"customName": "pin with label",
"async": true,
"drawable": true,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
},
"startPoint": [
0,
0,
0
],
"endPoint": [
0,
5,
2
],
"direction": [
0,
0,
1
],
"offsetFromStart": 0.1,
"label": "Affector",
"labelOffset": 0.3,
"labelSize": 0.1
},
"inputs": {
"endPoint": {
"connections": [
{
"node": "7b30d93ddc67215e",
"output": "result",
"data": {}
}
]
},
"startPoint": {
"connections": [
{
"node": "e3e97d1a757cfadc",
"output": "result",
"data": {}
}
]
}
},
"position": [
3232.1990358973653,
-753.8800452539867
]
}
}
}

How It Works

This example creates hexagonal faces that vary in size based on their distance from a control point, creating natural-looking patterns.

Step-by-Step Process

  1. Set up the grid parameters - Define width, height, and number of hexagons
  2. Create a control point - Use UV coordinates (0 to 1) to position it on the grid
  3. Calculate distances - Measure how far each hexagon center is from the control point
  4. Scale the hexagons - Closer hexagons become larger, distant ones become smaller
  5. Apply patterns - Optionally remove some hexagons to create openings

The Math Behind It

The key is remapping distances to scale values:

  • Find the shortest and longest distances
  • Convert these to scale factors between 0.211 and 0.9
  • Apply these scales to make hexagons bigger or smaller

Why Use UV Coordinates?

UV coordinates (from 0 to 1) are better than exact positions because:

  • U=0 means left edge, U=1 means right edge
  • V=0 means bottom edge, V=1 means top edge
  • Works the same regardless of grid size
  • Easy to understand and adjust

Pattern Control

The inclusionPattern lets you remove hexagons in a repeating pattern:

  • [true, true, false] = show 2, skip 1, repeat
  • [true, true, true, true, false] = show 4, skip 1, repeat

Real-World Uses

  • Architecture: Building facades that respond to sunlight or wind
  • Product Design: Grip patterns, ventilation holes, decorative surfaces
  • Interior Design: Ceiling panels, wall textures, lighting patterns

The beauty of this approach is that simple distance calculations create complex, organic-looking patterns that feel natural rather than mechanical.