Model Synthesis
Generates large 3D models from a small example by growing the output in modifiable chunks while ensuring every local neighbourhood appears in the input; the direct predecessor of WFC.
Also known as example-based model synthesis, Merrell model synthesis
In the family Procedural generation, constraint-based synthesis
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 Merrell Model Synthesis procedural 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 example model is analysed into local neighbourhood relations: which cell labels may be adjacent along each axis. The output volume is initialised with all labels possible, then filled by an order of assignment (e.g. one chunk or slice at a time) where each cell chooses a label compatible with already-assigned neighbours; constraint propagation removes impossible labels from unassigned cells. Merrell's insight was to modify small regions at a time so a dead end only forces re-doing that region (a limited form of local backtracking), keeping the process tractable. The 2007 paper applies it to polyhedral structures with adjacency via shared faces; the 2011 follow-up extends it to a general procedural modeling algorithm and adds user constraints like shape, connectivity and symmetries.
When to choose it
Reach for it when
- need to generate large buildings from a small example model
- want constraint-controlled 3d structure generation
- wave collapse fails on very large outputs
- synthesise architecture that follows user constraints
Choose it for 3D structure generation (buildings, architecture, bridges) from an example model with explicit user constraints, or when you want a deterministic, chunked solver for very large outputs. Prefer Wave Function Collapse for entropy-driven, mostly 2D tile and bitmap synthesis with huge community tooling, and CGA Shape Grammar (Procedural Buildings) when buildings should follow an explicit grammar instead of an example.
Field marks
- Output only reproduces local patterns of the input, so large-scale composition is incoherent without extra constraints
- Poorly chosen adjacency relations over-constrain the solver and yield contradictions
- Chunked solving can show seams or repeated motifs at chunk boundaries
- Needs cleanly voxelised or grid-aligned examples: arbitrary meshes need a labelling step
Presets
Model Synthesis — adjacency-constrained tile graph (left) vs grown 3D modular city blocks (right)
{
"P_CITY_SCALE": 2.2,
"P_CHUNK_WAVE": 0.85,
"P_CAM_ORBIT": 0.35,
"P_SPLIT": 0.46
}Show GLSL (139 lines)
const float P_CITY_SCALE = 2.2; // P Module Density [1.2, 3.6, 0.1]
const float P_CHUNK_WAVE = 0.85; // P Chunk Growth [0.2, 1.0, 0.02]
const float P_CAM_ORBIT = 0.35; // P Orbit Speed [0.0, 1.8, 0.05]
const float P_SPLIT = 0.46; // P Adjacency / 3D City [0.0, 1.0, 0.02]
mat2 rot2(float a) { float c = cos(a), s = sin(a); return mat2(c, -s, s, c); }
float hash21(vec2 p) {
p = fract(p * vec2(127.1, 311.7));
p += dot(p, p + 34.5);
return fract(p.x * p.y);
}
// Adjacency-consistent architectural module selector (Merrell 2007 Model Synthesis):
// Guarantees roads align seamlessly with neighbors, courtyards border towers, and bridges span canals!
vec2 evalModule(vec2 cell) {
// Periodic road & canal spines guarantee global topological connectivity across chunks
float isRoadX = step(abs(mod(cell.y + 2.0, 4.0) - 2.0), 0.1);
float isRoadZ = step(abs(mod(cell.x + 2.0, 4.0) - 2.0), 0.1);
if (isRoadX + isRoadZ > 0.5) {
return vec2(0.06, 1.0); // 1 = road/plaza tile
}
// Inside city blocks, neighbor-coherent tower height from smoothed hash
float h = hash21(cell);
float hNbr = hash21(cell + vec2(1.0, 0.0));
float tiers = floor(mix(h, hNbr, 0.35) * 4.0 + 1.0);
float height = 0.16 + tiers * 0.18;
float kind = (tiers >= 3.0) ? 3.0 : 2.0; // 2 = mid-rise terrace, 3 = spire tower
return vec2(height, kind);
}
vec2 mapCity(vec3 p, float scale) {
vec2 g = p.xz * scale;
vec2 cell = floor(g);
vec2 f = fract(g) - 0.5;
vec2 modInfo = evalModule(cell);
// Ground plaza plane
vec2 res = vec2(p.y + 0.45, 1.0);
// Extruded architectural module box inside each grid cell
float halfW = (modInfo.y > 2.5) ? 0.34 : 0.41;
vec3 b = vec3(halfW / scale, modInfo.x, halfW / scale);
vec3 lp = vec3(f.x / scale, p.y + 0.45 - modInfo.x, f.y / scale);
vec3 q = abs(lp) - b;
float dBox = length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - 0.008;
// Limit step size near cell boundaries for artifact-free raymarching across grid
float edgeLim = (0.5 - max(abs(f.x), abs(f.y))) / scale + 0.04;
float dMod = min(dBox, edgeLim);
if (dMod < res.x) res = vec2(dMod, modInfo.y);
return res;
}
vec3 calcNormal(vec3 p, float scale) {
vec2 e = vec2(0.004, 0.0);
return normalize(vec3(
mapCity(p + e.xyy, scale).x - mapCity(p - e.xyy, scale).x,
mapCity(p + e.yxy, scale).x - mapCity(p - e.yxy, scale).x,
mapCity(p + e.yyx, scale).x - mapCity(p - e.yyx, scale).x
));
}
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 screenX = fragCoord.x / max(iResolution.x, 1.0);
float split = clamp(P_SPLIT, 0.0, 1.0);
bool isGraph = screenX < split;
float scale = clamp(P_CITY_SCALE, 1.0, 3.8);
float chunkW = clamp(P_CHUNK_WAVE, 0.15, 1.0);
float spin = iTime * max(P_CAM_ORBIT, 0.0) * 0.35;
vec3 ro = vec3(0.0, 1.55, 2.65);
vec3 rd = normalize(vec3(uv.x, uv.y - 0.44, -1.35));
ro.xz = rot2(spin) * ro.xz;
rd.xz = rot2(spin) * rd.xz;
vec3 sky = mix(vec3(0.86, 0.72, 0.58), vec3(0.16, 0.32, 0.58), smoothstep(-0.08, 0.52, rd.y));
vec3 col = sky;
float t = 0.2;
vec2 hit = vec2(1e5, 0.0);
for (int i = 0; i < 68; i++) {
vec2 h = mapCity(ro + rd * t, scale);
if (h.x < 0.004) { hit = vec2(t, h.y); break; }
t += max(h.x * 0.72, 0.015);
if (t > 12.0) break;
}
if (hit.x < 1e4) {
vec3 p = ro + rd * hit.x;
vec3 n = calcNormal(p, scale);
vec3 sunDir = normalize(vec3(0.62, 0.75, 0.42));
float diff = max(dot(n, sunDir), 0.0);
vec2 g = p.xz * scale;
vec2 cell = floor(g);
vec2 f = fract(g);
vec2 dCell = min(f, 1.0 - f);
float gridLine = smoothstep(0.06, 0.015, min(dCell.x, dCell.y));
if (isGraph) {
// Left: Modifiable-chunk tile-adjacency state visualization (color-coded by tile prototype & chunk boundary)
vec3 tileCol = vec3(0.14, 0.24, 0.36);
if (hit.y > 1.5 && hit.y < 2.5) tileCol = vec3(0.18, 0.72, 0.88);
else if (hit.y > 2.5) tileCol = vec3(0.96, 0.58, 0.20);
// Chunk boundary box highlight every 4x4 modules
vec2 chunkF = fract(cell / 4.0);
float chunkEdge = smoothstep(0.08, 0.02, min(min(chunkF.x, 1.0 - chunkF.x), min(chunkF.y, 1.0 - chunkF.y)));
float scan = exp(-abs(length(p.xz) - fract(iTime * 0.18) * 3.8 * chunkW) * 6.0);
col = tileCol * (0.38 + 0.72 * diff) + vec3(0.95, 0.98, 1.0) * gridLine * 0.35 + vec3(0.24, 1.0, 0.76) * (chunkEdge * 0.35 + scan * 0.45);
} else {
// Right: Shaded modular limestone/terracotta synthesized city with lit window facades!
vec3 alb = vec3(0.32, 0.34, 0.38); // road plaza
if (hit.y > 1.5 && hit.y < 2.5) alb = vec3(0.84, 0.76, 0.66);
else if (hit.y > 2.5) alb = vec3(0.76, 0.64, 0.54);
// Terracotta rooftop cap
if (n.y > 0.8 && hit.y > 1.5) alb = mix(alb, vec3(0.76, 0.36, 0.24), 0.72);
// Procedural facade windows on vertical walls
float winMask = 0.0;
if (abs(n.y) < 0.3 && hit.y > 1.5) {
vec2 wUV = fract(vec2((p.x + p.z) * scale * 4.0, p.y * 12.0));
winMask = step(0.24, wUV.x) * step(wUV.x, 0.76) * step(0.25, wUV.y) * step(wUV.y, 0.78);
alb = mix(alb, vec3(0.14, 0.22, 0.32), winMask * 0.75);
}
col = alb * (0.26 + 0.88 * diff) + vec3(0.98, 0.80, 0.42) * winMask * 0.18;
}
col = mix(col, sky, 1.0 - exp(-hit.x * 0.075));
}
float sep = smoothstep(0.0035, 0.0008, abs(screenX - split));
col = mix(col, vec3(0.95, 0.97, 1.0), sep);
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 |
|---|---|---|---|
| model-synthesis-live | Tesla T4 1920x1080 | 66.4× baseline (extreme) · 2.18 ms / 2.25 ms | opengl-timer-query · 32 frames · GPU Weight Atlas · Colab T4 sweep |
| model-synthesis-live | NVIDIA L4 1920x1080 | 61.9× baseline (extreme) · 0.985 ms / 1.01 ms · 2.2× faster on L4 | opengl-timer-query · Cross-architecture validation |
| model-synthesis-live | NVIDIA A100-SXM4-40GB 1920x1080 | 44.4× baseline (heavy) · 1.28 ms / 1.29 ms · 1.7× faster on A100 | opengl-timer-query · Cross-architecture validation |
Lineage
From the citation graph (Crossref reference lists): its primary source cites Wang Tiles (Aperiodic Tile Synthesis), Image quilting, CGA Shape Grammar (Procedural Buildings), Fractal Brownian Motion and Multifractals, Procedural City Generation (L-system Road Networks).
Crosses
- Prompted kits, synthesised levels: From a text prompt, generate a modular kit whose pieces share socket dimensions by construction, then let model synthesis assemble large consistent levels from a small example built with those pieces.
Sources
- primaryPaul Merrell (2007). Example-based model synthesis. Proceedings of the 2007 symposium on Interactive 3D graphics and games.Verified via crossref · 2026-11-29doi:10.1145/1230100.1230119
- primaryP Merrell, D Manocha (2011). Model Synthesis: A General Procedural Modeling Algorithm. IEEE Transactions on Visualization and Computer Graphics.Verified via crossref · 2026-11-29doi:10.1109/tvcg.2010.112