Greebling
Adds small, plausible-looking mechanical detail (boxes, pipes, panels, vents) over large hard-surface forms so a flat hull or wall reads as complex, engineered scale.
Also known as greebles, kitbashing detail, surface detail scattering
In the family Procedural generation, hard-surface detail
Where it runs
Built inOfficial add-onPluginNone foundNot researched
| Engine | Support | How |
|---|---|---|
| three.js r187 | None found | |
| Babylon.js 9.38.0 | None found | |
| Godot 4.7 | None found | No built-in procedural greebling mesh generator. |
| Unity | None found | |
| Unreal 5.7 | None found | |
| Blender 5.2 | None found | |
| WebGPU W3C | None found | |
| Metal | None found |
How it works
The base mesh is analysed for face regions: large planar quads are split into panels by recursive subdivision (often along their longer axis), and each resulting panel is displaced by a small random depth or extruded into a block, with sizes sampled from a distribution that mimics real manufacturing detail. Greeble kits are libraries of small modules (vents, hatches, pipes) scattered onto panels with instancing, with size and density tied to distance from edges or to a mask. Rules can enforce orientation, spacing (blue noise) and no-intersection tests. The effect is mostly additive geometry or normal-map detail, giving high visual complexity at low authoring cost.
When to choose it
Reach for it when
- flat spaceship hull looks empty and scale-less
- sci-fi wall needs fine mechanical detail fast
- large surfaces read as toy-like without small details
- automatically scatter pipes, panels and vents
- make machinery look engineered and huge
Choose it for spaceships, sci-fi walls and machinery, where the silhouette and secondary detail sell scale. Prefer CGA Shape Grammar (Procedural Buildings) for architectural facades with consistent structure, Procedural Kit Modeling with Verification (procgen-kit) when parts must be parametric, watertight and collision-verified, and Poisson Disk Sampling (Bridson) for the placement of modules.
Field marks
- Random uniform detail looks noisy without hierarchy: real structures have large, medium and small elements
- Overlapping or floating modules because placement ignores neighbour geometry
- Scale confusion: wrong module size relative to implied human scale breaks the sense of size
- Triangle counts balloon quickly if the splits are not limited
Presets
Hierarchical sci-fi hull greebling — recursive panel subdivision, extruded blocks, vents and lights
{
"SCALE": 3.2,
"DEPTH": 0.16,
"PANEL_DETAIL": 4,
"LIGHT_DENSITY": 0.28
}Show GLSL (121 lines)
const float SCALE = 3.2; // P
const float DEPTH = 0.16; // P
const int PANEL_DETAIL = 4; // P
const float LIGHT_DENSITY = 0.28; // P
float hash21(vec2 p) {
vec3 q = fract(vec3(p.xyx) * vec3(0.1031, 0.1030, 0.0973));
q += dot(q, q.yzx + 33.33);
return fract((q.x + q.y) * q.z);
}
// Multi-level recursive quad-panel greeble heightfield (large hull plates -> modules -> vents/pipes)
vec3 evalGreeble(vec2 p, out float lightMask, out float seamMask) {
int levels = clamp(PANEL_DETAIL, 1, 5);
float h = 0.0;
float matTone = 0.5;
lightMask = 0.0;
seamMask = 0.0;
vec2 q = p * max(SCALE, 0.5);
float amp = 1.0;
for (int lv = 0; lv < 5; lv++) {
if (lv >= levels) break;
vec2 id = floor(q);
vec2 f = fract(q);
float r1 = hash21(id + float(lv) * 19.7);
float r2 = hash21(id + float(lv) * 43.3 + 7.1);
// Split panel along alternating aspect ratios for authentic engineered hierarchy
vec2 edge = min(f, 1.0 - f);
float border = min(edge.x, edge.y);
float bevel = smoothstep(0.025, 0.075, border);
seamMask = max(seamMask, smoothstep(0.06, 0.015, border) * amp);
float blockH = (0.25 + 0.75 * r1) * bevel;
// Louver cooling vents on ~22% of mid-level panels
if (lv >= 1 && r2 > 0.76) {
float louver = 0.5 + 0.5 * sin(f.y * 37.7);
blockH *= 0.65 + 0.35 * step(0.45, louver);
}
// Recessed cylindrical conduit pipes on ~18% of panels
if (lv == 1 && r2 < 0.20) {
float pipe = smoothstep(0.16, 0.04, abs(f.x - 0.5));
blockH = mix(blockH * 0.4, 0.95, pipe);
}
h += blockH * amp;
matTone = mix(matTone, 0.28 + 0.52 * r2, amp * 0.45);
// Tiny glowing viewport slits on fine panels
if (lv >= 2 && r1 < clamp(LIGHT_DENSITY, 0.0, 1.0)) {
float win = smoothstep(0.18, 0.10, abs(f.y - 0.5)) * smoothstep(0.36, 0.28, abs(f.x - 0.5));
lightMask = max(lightMask, win * (r2 > 0.5 ? 1.0 : 2.0));
}
// Subdivide selectively based on cell hash so large plates coexist with dense clusters
float sub = (r1 > 0.35) ? 2.0 : 1.0;
q = fract(q) * sub + floor(q) * 2.0 + vec2(r2 * 1.3, r1 * 2.1);
amp *= 0.52;
}
return vec3(h * max(DEPTH, 0.01), matTone, 0.0);
}
vec3 aces(vec3 x) {
x = max(x, 0.0);
return (x * (2.51 * x + 0.03)) / (x * (2.43 * x + 0.59) + 0.14);
}
void mainImage(out vec4 fragColor, in vec2 fragCoord) {
vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
float camTilt = 0.28;
if (iMouse.z > 0.5 || length(iMouse.xy) > 1.0) {
camTilt = clamp((iMouse.y / iResolution.y) * 0.65 + 0.05, 0.05, 0.72);
}
vec3 ro = vec3(0.0, 1.35, -iTime * 0.35);
vec3 rd = normalize(vec3(uv.x, uv.y - camTilt - 0.32, -1.25));
// Raymarch perspective hull heightfield y = greeble(xz)
float t = 0.4, maxT = 16.0;
bool hit = false;
float lm = 0.0, sm = 0.0;
vec3 gVal = vec3(0.0);
for (int i = 0; i < 64; i++) {
vec3 p = ro + rd * t;
gVal = evalGreeble(p.xz, lm, sm);
float d = p.y - gVal.x;
if (d < 0.004) { hit = true; break; }
t += max(d * 0.55, 0.025 + t * 0.012);
if (t > maxT) break;
}
vec3 sky = mix(vec3(0.02, 0.04, 0.08), vec3(0.10, 0.16, 0.28), clamp(uv.y + 0.5, 0.0, 1.0));
vec3 col = sky;
if (hit) {
vec3 p = ro + rd * t;
float e = 0.008 + 0.003 * t;
float l0, s0;
float hx = evalGreeble(p.xz + vec2(e, 0.0), l0, s0).x - gVal.x;
float hz = evalGreeble(p.xz + vec2(0.0, e), l0, s0).x - gVal.x;
vec3 n = normalize(vec3(-hx, e, -hz));
vec3 keyDir = normalize(vec3(0.72, 0.58, 0.38));
vec3 rimDir = normalize(vec3(-0.75, 0.35, -0.55));
float nl = max(dot(n, keyDir), 0.0);
float rim = max(dot(n, rimDir), 0.0);
vec3 H = normalize(keyDir - rd);
float spec = pow(max(dot(n, H), 0.0), 36.0);
float ao = clamp(0.32 + 0.68 * (gVal.x / max(DEPTH * 1.4, 0.01)), 0.22, 1.0) * (1.0 - sm * 0.48);
vec3 hullAlb = mix(vec3(0.16, 0.19, 0.24), vec3(0.46, 0.50, 0.55), gVal.y);
col = hullAlb * ao * (vec3(0.08, 0.13, 0.22) + vec3(1.65, 1.48, 1.25) * nl + vec3(0.28, 0.52, 0.85) * rim * 0.65);
col += vec3(0.95, 0.90, 0.82) * spec * ao * 0.55;
// Emissive hull viewport lights (amber & cyan)
if (lm > 0.05) {
vec3 eCol = (lm > 1.5) ? vec3(0.35, 1.65, 2.4) : vec3(2.4, 1.35, 0.35);
col += eCol * smoothstep(0.05, 0.9, fract(lm + 0.999));
}
col = mix(col, sky, 1.0 - exp(-0.085 * t));
}
fragColor = vec4(pow(clamp(aces(col), 0.0, 1.0), vec3(1.0 / 2.2)), 1.0);
}Attribution: MIT — written for this index
Measured GPU weight & timing
| Preset | GPU | Weight / p50 / p95 | Method |
|---|---|---|---|
| greebling-live | Tesla T4 1920x1080 | 155× baseline (extreme) · 5.11 ms / 5.17 ms | opengl-timer-query · 40 frames · GPU Weight Atlas · Colab T4 sweep |
| greebling-live | NVIDIA L4 1920x1080 | 129× baseline (extreme) · 2.06 ms / 2.10 ms · 2.5× faster on L4 | opengl-timer-query · Cross-architecture validation |
| greebling-live | NVIDIA A100-SXM4-40GB 1920x1080 | 102× baseline (extreme) · 2.94 ms / 2.95 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |