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
Hexagons scaled by distance on a face
Bitbybit Platform

Hexagons scaled by distance on a face in Rete

rete logoRete
Script Source (rete)
{
"id": "rete-v2-json",
"nodes": {
"width": {
"id": "width",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {
"min": 5,
"max": 20,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 16.5
},
"inputs": {},
"position": [
429,
1082
]
},
"heigt": {
"id": "heigt",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {},
"number": 9
},
"inputs": {},
"position": [
425,
1237
]
},
"subdivisionsW": {
"id": "subdivisionsW",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {
"min": 5,
"max": 40,
"step": 1,
"width": 350,
"updateOnDrag": false
},
"number": 29
},
"inputs": {},
"position": [
419,
1401
]
},
"subdivisionsH": {
"id": "subdivisionsH",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {
"min": 0,
"max": 40,
"step": 0.1,
"width": 350,
"updateOnDrag": false
},
"number": 29
},
"inputs": {},
"position": [
421,
1554
]
},
"hexGridScaledToFit": {
"id": "hexGridScaledToFit",
"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": "width",
"output": "result",
"data": {}
}
]
},
"height": {
"connections": [
{
"node": "heigt",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInWidth": {
"connections": [
{
"node": "subdivisionsW",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInHeight": {
"connections": [
{
"node": "subdivisionsH",
"output": "result",
"data": {}
}
]
}
},
"position": [
1229,
465
]
},
"getValueOnProp": {
"id": "getValueOnProp",
"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": "hexGridScaledToFit",
"output": "result",
"data": {}
}
]
}
},
"position": [
1631,
465
]
},
"distancesToPoints": {
"id": "distancesToPoints",
"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": "pointOnUv",
"output": "result",
"data": {}
}
]
},
"endPoints": {
"connections": [
{
"node": "getValueOnProp",
"output": "result",
"data": {}
}
]
}
},
"position": [
2466,
224
]
},
"max": {
"id": "max",
"name": "bitbybit.vector.max",
"customName": "max",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"vector": {
"connections": [
{
"node": "distancesToPoints",
"output": "result",
"data": {}
}
]
}
},
"position": [
2933,
487
]
},
"min": {
"id": "min",
"name": "bitbybit.vector.min",
"customName": "min",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"vector": {
"connections": [
{
"node": "distancesToPoints",
"output": "result",
"data": {}
}
]
}
},
"position": [
2936,
225
]
},
"remap": {
"id": "remap",
"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": "max",
"output": "result",
"data": {}
}
]
},
"fromLow": {
"connections": [
{
"node": "min",
"output": "result",
"data": {}
}
]
},
"number": {
"connections": [
{
"node": "flatten",
"output": "result",
"data": {}
}
]
}
},
"position": [
3388,
182
]
},
"flatten": {
"id": "flatten",
"name": "bitbybit.lists.flatten",
"customName": "flatten",
"async": false,
"drawable": false,
"data": {
"nrLevels": 1
},
"inputs": {
"list": {
"connections": [
{
"node": "distancesToPoints",
"output": "result",
"data": {}
}
]
}
},
"position": [
2938,
14
]
},
"parse": {
"id": "parse",
"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": [
4182,
1698
]
},
"hexagonsInGrid": {
"id": "hexagonsInGrid",
"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": "width",
"output": "result",
"data": {}
}
]
},
"height": {
"connections": [
{
"node": "heigt",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInWidth": {
"connections": [
{
"node": "subdivisionsW",
"output": "result",
"data": {}
}
]
},
"nrHexagonsInHeight": {
"connections": [
{
"node": "subdivisionsH",
"output": "result",
"data": {}
}
]
},
"scalePatternWidth": {
"connections": [
{
"node": "createList",
"output": "list",
"data": {}
}
]
},
"scalePatternHeight": {
"connections": [
{
"node": "createList",
"output": "list",
"data": {}
}
]
},
"inclusionPattern": {
"connections": [
{
"node": "parse",
"output": "result",
"data": {}
}
]
}
},
"position": [
4602,
1180
]
},
"rectangleFace": {
"id": "rectangleFace",
"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": "width",
"output": "result",
"data": {}
}
]
},
"length": {
"connections": [
{
"node": "heigt",
"output": "result",
"data": {}
}
]
}
},
"position": [
1233,
67
]
},
"pointOnUv": {
"id": "pointOnUv",
"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": "rectangleFace",
"output": "result",
"data": {}
}
]
},
"paramU": {
"connections": [
{
"node": "u1",
"output": "result",
"data": {}
}
]
},
"paramV": {
"connections": [
{
"node": "v1",
"output": "result",
"data": {}
}
]
}
},
"position": [
1805,
-345
]
},
"u1": {
"id": "u1",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {
"min": 0,
"max": 1,
"step": 0.01,
"width": 350,
"updateOnDrag": false
},
"number": 0
},
"inputs": {},
"position": [
482,
-303
]
},
"v1": {
"id": "v1",
"name": "bitbybit.math.numberSlider",
"customName": "number slider",
"async": false,
"drawable": false,
"data": {
"options": {
"min": 0,
"max": 1,
"step": 0.01,
"width": 350,
"updateOnDrag": false
},
"number": 0.49
},
"inputs": {},
"position": [
478,
-143
]
},
"createList": {
"id": "createList",
"name": "bitbybit.lists.createList",
"customName": "create list",
"async": false,
"drawable": false,
"data": {},
"inputs": {
"listElements": {
"connections": [
{
"node": "remap",
"output": "result",
"data": {}
}
]
}
},
"position": [
3774,
222
]
},
"add": {
"id": "add",
"name": "bitbybit.vector.add",
"customName": "add",
"async": false,
"drawable": false,
"data": {
"genericNodeData": {
"hide": false,
"oneOnOne": false,
"flatten": 0,
"forceExecution": false
}
},
"inputs": {
"first": {
"connections": [
{
"node": "pointOnUv",
"output": "result",
"data": {}
}
]
},
"second": {
"connections": [
{
"node": "vectorXyz",
"output": "result",
"data": {}
}
]
}
},
"position": [
2809,
-470
]
},
"vectorXyz": {
"id": "vectorXyz",
"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": [
2408,
-248
]
},
"pinWithLabel": {
"id": "pinWithLabel",
"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,
"endType": "none",
"arrowSize": 0.3,
"arrowAngle": 30,
"arrowsFlipped": false,
"labelRotation": 0,
"labelFlipHorizontal": false,
"labelFlipVertical": false
},
"inputs": {
"endPoint": {
"connections": [
{
"node": "add",
"output": "result",
"data": {}
}
]
},
"startPoint": {
"connections": [
{
"node": "pointOnUv",
"output": "result",
"data": {}
}
]
}
},
"position": [
3232,
-754
]
}
},
"modules": {}
}

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.