@bendyline/molen-tooling 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, Q as formatBytes, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, s as simWatch, t as formatWorldgenStats, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-2qoHKV54.mjs";
2
+ import { $ as formatPacked, A as inspectContentPack, B as searchDocs, C as checkTypesOp, D as buildContentPack, E as reserveNamespace, F as previewFigure, H as describeOps, I as listFigurePresets, J as checkSoundbank, K as planAudio, L as exportFrames, M as bakeNetwork, N as generateTypes, O as extractContentPack, Q as formatBytes, R as driveScene, S as rasterizeMaterial, T as projectInfo, U as formatOp, V as OPS_CATALOG, W as checkScripts, X as stageAssets, Z as screenshotAsset, _ as loadComponentRegistry, b as diffSnapshots, c as validateAsset, d as runSimulation, dt as playExperience, et as packAsset, f as screenshotScene, g as listSchemasOp, h as listComponentsOp, i as bakeWorldgen, it as importAsset, j as verifyContentPack, k as fetchContentPack, l as applyUvPaintOp, m as getSchemaOp, n as worldgenStats, nt as listAssets, p as getComponentOp, q as importSound, r as previewWorldgen, s as simWatch, t as formatWorldgenStats, tt as inspectAsset, u as testTypes, v as scaffoldExperience, w as listTypes, x as runReplayFile, y as listTemplates } from "./ops-CErtZh2t.mjs";
3
3
  import { dirname, join } from "node:path";
4
4
  import { readFileSync } from "node:fs";
5
5
  import { formatIssues } from "@bendyline/molen-schema";
@@ -1254,7 +1254,7 @@ async function cmdWorldgen(args) {
1254
1254
  return 2;
1255
1255
  }
1256
1256
  async function cmdMcp() {
1257
- const { startMcpServer } = await import("./mcp-ClDdiqq4.mjs");
1257
+ const { startMcpServer } = await import("./mcp-BbHk4ibu.mjs");
1258
1258
  await startMcpServer();
1259
1259
  return 0;
1260
1260
  }
@@ -1,9 +1,10 @@
1
1
  # 3D art guidelines
2
2
 
3
- Molen's baseline is a readable polygonal world: strong silhouettes, restrained palettes, clear
4
- material blocks, and modest surface detail. A building or prop should remain recognizable when
5
- textures are disabled. Textures add material character such as brick courses; they do not carry
6
- the entire identity.
3
+ Molen's baseline is a readable polygonal world: strong silhouettes, clear, coherent palettes,
4
+ clear material blocks, and modest surface detail. A building or prop should remain recognizable
5
+ when textures are disabled. Textures add material character such as brick courses; they do not
6
+ carry the entire identity. For anything shown in the Earth view, the
7
+ [medium-fi style guide](medium-fi.md) sets the target look, palette bands and budgets.
7
8
 
8
9
  These guidelines apply to imported static GLBs, built-in instanced props, and parameterized
9
10
  worldgen buildings. They are authoring targets, not new runtime hard limits. Use the existing
@@ -89,19 +90,22 @@ Review every preset from the front, three-quarter, rear and gameplay distance
89
90
 
90
91
  ## Color, light and material response
91
92
 
92
- Use muted wall/ground colors and reserve saturated accents for identity and wayfinding.
93
- Limit each object to roughly three to five intentional colors, excluding small surface variation.
94
- Roof and foundation values should separate from the wall without outlining every edge.
93
+ Use clear, hued wall and ground colors inside the lightness bands of the
94
+ [medium-fi palette](medium-fi.md#color-and-palette), and reserve strongly saturated accents for
95
+ identity and wayfinding. Limit each object to roughly three to five intentional colors,
96
+ excluding small surface variation. Roof and foundation values should separate from the wall
97
+ without outlining every edge.
95
98
 
96
99
  Author with neutral daylight, real cast shadows and a shadow-receiving ground. Base color must
97
100
  not contain baked directional shadows or highlights. Prefer rough matte paint, brick, concrete,
98
101
  wood, and coated metal; glass should read as glazing without becoming a mirror everywhere.
99
102
  Use material variation to explain construction, not to disguise missing geometry.
100
103
 
101
- For GLB PBR assets, base color/emissive are sRGB; normal, roughness, metalness and occlusion are
102
- linear data. Existing worldgen palette helpers and three.js color inputs have different conversion
103
- paths: compare rendered swatches when transferring colors between static and procedural assets,
104
- rather than copying a linear buffer value into an sRGB authoring field.
104
+ For GLB PBR assets, base color/emissive textures are sRGB; normal, roughness, metalness and
105
+ occlusion are linear data, and so are `COLOR_0` vertex colors and `baseColorFactor`. Worldgen
106
+ palettes and other hex colors are sRGB, and the client decodes procedural vertex colors to linear
107
+ before rendering, so a swatch renders as that swatch. When moving a palette color into a GLB,
108
+ convert it from sRGB to linear rather than copying the hex value's bytes.
105
109
 
106
110
  ## Canonical material library
107
111
 
@@ -31,6 +31,15 @@ For programmatic captures of reflective metal or glass, pass `reflections: true`
31
31
  viewer's shared procedural sky/ground environment; the default remains the legacy light rig.
32
32
  The repository landmark capture script accepts `--reflections` and records that mode in its
33
33
  hash-bound report. See [sky reflections](sky.md#reflections) for the runtime lighting model.
34
+ For fine glazing joints, rails or louvres, programmatic `screenshotScene` and `screenshotAsset`
35
+ calls also accept `antialias: true`. The landmark capture script exposes this as `--antialias`
36
+ and records it in the report, so changing the setting invalidates cached captures. The default
37
+ remains false for existing golden captures. Antialiasing reduces subpixel edge artifacts;
38
+ it does not replace reviewing distant detail or authoring appropriate levels of detail.
39
+ For large structures, `screenshotScene({ fitShadows: true, ... })` fits enabled sun shadows
40
+ to the loaded scene bounds using the viewer's shadow-focus system. The landmark capture
41
+ script records `--fit-shadows` separately. The default fixed shadow box is preserved;
42
+ the option does not turn shadows on in scenes where they are disabled.
34
43
 
35
44
  ## 1. Convert the prompt into an asset brief
36
45
 
@@ -32,6 +32,19 @@ ultrawide displays. CPU caches and resident geometry have separate limits:
32
32
  | High | 2,800,000 | 2.4 px | 96 | 400 MiB | 96 MiB |
33
33
  | Ultra | 4,000,000 | 1.75 px | 128 | 544 MiB | 128 MiB |
34
34
 
35
+ Each tier also names its sun shadow quality (`EarthPerformanceTier.shadows`): off at Minimum and
36
+ Low, medium at Medium, and high from Balanced up. On WebGPU the main pass keeps its render bundles
37
+ while shadows are on, but every bundled object refreshes each frame, because that refresh is what
38
+ redraws the shadow map and keeps receivers in step with it; shadows therefore cost real CPU time
39
+ on WebGPU, and the controller accounts for it like any other work. Bundles exist only inside
40
+ the frame. Between frames, warm-up compiles run the sun's shadow pass over the scene, and there
41
+ the groups draw normally, so a tile that an admission job swapped and disposed is never replayed
42
+ from a stale bundle. Once a WebGPU shadow map
43
+ exists it keeps its size, and "off" stops redrawing it and fades it out rather than releasing it,
44
+ because three.js's WebGPU shadow node cannot be torn down and rebuilt in place. Tiers change cost, never the
45
+ look: the palette, light rig and styles are the same in every tier (see the
46
+ [medium-fi style guide](medium-fi.md#rendering-modes)).
47
+
35
48
  Resident byte estimates count retained height arrays, geometry attributes/indices and instance
36
49
  buffers, deduplicating shared backing storage within each object. They exclude textures, archive
37
50
  caches and GPU copies, so they are not total device memory measurements. The resident cap is soft:
@@ -135,7 +135,7 @@ Two constants live in `packages/kernel/src/version.ts` and they do different job
135
135
 
136
136
  | Constant | Today | Role |
137
137
  |---|---|---|
138
- | `ENGINE_VERSION` | `0.0.4` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
138
+ | `ENGINE_VERSION` | `0.0.6` | metadata. Written into a keyframe's `engine` field so a save says which build wrote it. **Never compared on load, never hashed.** |
139
139
  | `STATE_FORMAT` | `1` | the gate. Written into a keyframe under the reserved `plugins.$format` key, compared by `applyKeyframeTo`, and folded into `stateHash` as `stateFormat`. |
140
140
 
141
141
  So a release — even one that moves every package — keeps your keyframes
@@ -56,6 +56,16 @@ reuses its filtered texture until lighting changes; camera movement does not reg
56
56
  Pass `reflections: false` for the legacy light-only appearance. A host-assigned
57
57
  `view.viewer.renderer.scene.environment` takes precedence if you supply your own HDR environment.
58
58
 
59
+ Without a `style`, the view uses the shared medium-fi look: a strong warm sun over a sky fill,
60
+ Khronos PBR Neutral tone mapping, and haze in the sky's horizon color. Its values are exported as
61
+ `EARTH_SKY_PALETTE`, `EARTH_LIGHTING`, `EARTH_TONE_MAPPING`, `EARTH_EXPOSURE` and
62
+ `EARTH_WATER_COLOR`, so a host that builds its own viewer can match it. `earthHazeColor` converts
63
+ a sky color into the fog color for the backend. Terrain and landcover share one ground material
64
+ from `createTerrainGroundMaterialAsync` (`@bendyline/molen-terrain/client`) with world-space
65
+ variation; a custom host passes it to the terrain stream's `material` and to `createEarthWorldgen`
66
+ as `groundMaterial`, and calls `setTerrainGroundOrigin` with the world origin each frame. The
67
+ [medium-fi style guide](medium-fi.md) explains the look and the rules models follow inside it.
68
+
59
69
  `style` sets the look: `sky.sunElevation` and `sky.sunAzimuth` (degrees; the azimuth is a
60
70
  compass bearing, 0 north and clockwise) place the sun, and unless `environment.sun.direction` is
61
71
  given the sunlight comes from the same point, so lit faces agree with the glow in the sky. `fog`,
@@ -356,13 +366,20 @@ model eviction. `build-copernicus-bridge-evidence.py` and the capture runner's
356
366
  neither capture set substitutes altered heights to make a bridge fit. These reports are research
357
367
  evidence and are excluded from the Earth runtime pack.
358
368
 
359
- If `replaceFootprint` is set, a mapped building is suppressed only when the anchor falls inside
360
- its polygon and the replacement model has loaded. Failed models keep the procedural building.
361
- Generalized sources (Protomaps below zoom 15, and tiles overzoomed from them) merge neighboring
362
- footprints, so there the polygon is suppressed only when neither side exceeds the loaded model's
363
- horizontal extent by more than 1.6 times plus 12 meters; a larger polygon is a merged block of
364
- other buildings and keeps its procedural shell. An Earth pack without a placement document still
365
- loads.
369
+ If `replaceFootprint` is set, mapped buildings are suppressed only once the replacement model
370
+ has loaded; failed models keep the procedural building. In exact data a polygon goes when the
371
+ anchor falls inside it, when it lies wholly inside the loaded model's horizontal extent around the
372
+ anchor, or when at least half of it stands on the model's own ground footprint (its triangles
373
+ stamped on a 64-cell grid). The last two catch a landmark's off-centre mapped parts: a tower's
374
+ legs and observation level, a grandstand, a ballpark's parked roof. The footprint also reaches
375
+ neighbouring tiles, so a stadium anchored near a tile edge clears its mapped stands there too.
376
+ Those tiles regenerate their buildings when the landmark loads, and again when its tile is evicted.
377
+ A ring polygon whose hole holds the anchor (a stadium bowl, a cloister) goes under the size rule
378
+ below. Generalized sources (Protomaps below zoom 15, and tiles overzoomed from them) merge
379
+ neighboring footprints, so there the polygon must contain or ring the anchor, and is suppressed
380
+ only when neither side exceeds the loaded model's horizontal extent by more than 1.6 times plus
381
+ 12 meters; a larger polygon is a merged block of other buildings and keeps its procedural shell.
382
+ An Earth pack without a placement document still loads.
366
383
 
367
384
  For unsurveyed orientation, `orientation: 'mapped'` requires an explicit
368
385
  `mapIdentity: { wikidata: 'Q…', maxDistance: 150 }`. The viewer admits that model only after a
@@ -462,15 +479,71 @@ placement evidence. Older historical sources without a complete supported date i
462
479
  drafts. Shared placement QA uses `capture-landmark-library.mjs --viewing-date=1930-01-01` and
463
480
  records the explicit date in its hash-bound report.
464
481
 
465
- Geographic and category models use `StructureModelLibrary`, preserving the authored mesh
466
- hierarchy, UV coordinates, texture maps, material assignments and PBR parameters. Instances
467
- share those resources until the last reference is released. Long static models retain their
468
- UVs, vertex attributes and material groups when clipped at tile edges; textures do not restart
469
- at each seam. The library accepts static assets: skinned or animated structures require a host
470
- animation implementation. Procedural scatter continues to use the separate instanced prop path.
482
+ Geographic and category models use `StructureLodStreamer`. Each asset has separately fetched
483
+ `skyline`, `district`, `street`, and `closeup` files in its sidecar's `runtimeLods`. The default
484
+ viewer loads skyline first and chooses detail by projected geometric error and remaining
485
+ budgets. The source master stays available for authoring and review. Generated close-ups are
486
+ reduced runtime models; they are not a promise of every detail in the master.
487
+
488
+ The streamer prioritizes nearby placements, limits concurrent requests, reserves memory before
489
+ loading, verifies payload hashes, and cancels unused requests. Instances keep the old level while
490
+ the replacement is prepared, then swap atomically. Placement, heading, elevation, ground cutouts
491
+ and bridge clipping are reapplied before publication. A five-second warm cache avoids immediately
492
+ reloading recently released models; memory pressure can evict unused models sooner. Shared
493
+ geometry and materials are counted once. Procedural scatter uses its separate instanced path.
494
+
495
+ | Default landmark allowance | Phone/tablet | Laptop/desktop |
496
+ | --- | ---: | ---: |
497
+ | Resident skyline payloads, uncompressed | 3 MB | 6 MB |
498
+ | Geometry CPU backing buffers | 64 MB | 192 MB |
499
+ | Estimated geometry GPU uploads | 64 MB | 192 MB |
500
+ | Shared worldgen textures, including mipmaps | 16 MB | 48 MB |
501
+ | Triangle / draw-call allowance | 350,000 / 100 | 1,000,000 / 200 |
502
+ | Concurrent model loads | 2 | 4 |
503
+ | Cooperative preparation time per frame | 2 ms | 4 ms |
504
+
505
+ These are decimal MB, separate from terrain, render targets, transport caches and parser/driver
506
+ overhead. Initial payload limits cover the active skyline set, not lifetime travel downloads or
507
+ pack metadata. Upgrades can download larger files after a one-second skyline grace period.
508
+ Draw/triangle admission reserves twice the nominal geometry cost for extra passes; shadows and
509
+ other renderer passes have their own costs. Preparation yields between instances; an individual
510
+ GLB parse or GPU upload can exceed the cooperative time allowance.
511
+
512
+ Touch devices or browsers reporting at most 4 GB use the phone preset. Hosts can choose explicitly:
513
+
514
+ ```ts
515
+ const view = await mountEarthView({
516
+ canvas,
517
+ // ... terrain source, content and other required options
518
+ landmarkStreaming: {
519
+ mobile: true,
520
+ budget: { maxInitialBytes: 3_000_000, maxGpuBytes: 64_000_000 },
521
+ },
522
+ });
523
+ // view.stats().structures: resident levels, payloads, geometry, texture bytes,
524
+ // queued/in-flight loads, upgrades, failures and evictions.
525
+ ```
526
+
527
+ Runtime variants use separate vertex attribute streams so Float32 positions and Uint8 colors
528
+ do not cause overlapping GPU uploads. The reducer preserves source material references on detailed
529
+ levels; skyline uses a single color material and local convex pieces derived from the source.
530
+ Small openings and fine trim can disappear in that distant silhouette. Detailed levels use
531
+ conservative reduction and can exceed their advisory triangle targets. Expensive models stay
532
+ coarse when an upgrade does not fit; source-authored LODs may be needed for more detail on phones.
533
+ Geometric error is an estimate for selection, not a certified maximum deviation.
534
+
535
+ Assets without current LOD metadata keep their procedural fallback in the default viewer. A host
536
+ can deliberately select `landmarkStreaming: false` to use the original `StructureModelLibrary`
537
+ and full imports for inspection or legacy content. Static geometry is required; animation and
538
+ skinning need a host-specific implementation.
471
539
 
472
540
  ### Shared architectural surfaces
473
541
 
542
+ The Earth viewer bakes shared surfaces when they are first used, with two concurrent jobs and the
543
+ texture allowance above. Each graph is cached once for that worldgen instance. If adding a texture
544
+ would exceed the allowance, its flat material remains usable. The library is released with the
545
+ worldgen instance. Rejected textures do not trigger a repeated bake every frame.
546
+
474
547
  Authored GLB materials can opt into the same texture library as procedural buildings. Set
475
548
  the material's glTF `extras.molenSurface` (available as Three.js material `userData.molenSurface`):
476
549
 
@@ -525,13 +598,18 @@ of images that may come from an external cache.
525
598
 
526
599
  Mapped roads with `bridge: true` receive solid decks, edge barriers and regularly spaced
527
600
  supports in the shared terrain surface renderer, including its worker path. Road, rail and
528
- pedestrian spans follow mapped centerlines and widths; tunnels are omitted. Complete spans
601
+ pedestrian spans follow mapped centerlines and widths. Complete spans
529
602
  interpolate between bank heights and connect to adjoining ground roads. Clipped spans use
530
603
  estimated terrain clearance (6 m for roads/rail, 3 m for paths); a semantic provider can set
531
604
  `deckElevation` to an absolute surveyed height. These are visual approximations: tile data
532
605
  does not establish bridge engineering type, navigation clearance, foundations or collision.
533
606
  The SR-520 preview replaces the floating section; its approaches use this same fallback.
534
607
 
608
+ Mapped tunnels receive separate inferred underground bores and portal cuts that retain the
609
+ terrain above them. Aircraft support queries use the bore floor while underground. Centerlines
610
+ alone do not establish surveyed grades, widths or clearances; see [Tunnels](surface-rendering.md#tunnels)
611
+ for the metadata overrides, inference and bounded route stitching.
612
+
535
613
  Regional procedural styles are separate from exact structures. The atlas's ordered rules use
536
614
  mapped building class, footprint size, context, and known height to choose a style. A rule can
537
615
  give weighted variants, sampled from a stable building identity, so a neighborhood has a
@@ -0,0 +1,328 @@
1
+ # Medium-fi style guide
2
+
3
+ Molen's Earth view draws the real planet at full scale in a browser, with thousands of buildings,
4
+ trees, vehicles and landmarks on screen at once. Its look is **medium-fi**: a bright, polygonal
5
+ model-railroad version of the world. This page sets the standard for every model, building
6
+ style, palette and prop made for it, and ends with the review an agent runs before submitting one.
7
+
8
+ Medium-fi sits between two looks it avoids. It is not low-fi, meaning voxels, pixel art or bare
9
+ grey boxes. It is not high-fi either: photoreal surfaces, or even the most detail the engine can
10
+ draw. The nearest reference is an open-world game of the early 2000s, Grand Theft Auto III or Vice
11
+ City. Proportions are realistic, faces are visibly polygonal, and shared textures are simple under
12
+ a strong sun. Every object reads clearly, the whole frame is coherent, and it holds 60 frames per
13
+ second on ordinary laptops.
14
+
15
+ ## Why medium-fi
16
+
17
+ Three constraints decide the style, and every rule below follows from one of them:
18
+
19
+ - **Scale.** A city view holds 20,000–35,000 procedural buildings and a few dozen landmarks.
20
+ Budgets are spent per frame across all of them, not per model.
21
+ - **The browser.** WebGPU or WebGL on integrated laptop GPUs, phones and the occasional
22
+ software rasterizer. Memory, draw calls and shader cost are tight.
23
+ - **Coherence.** Most buildings are generated from map footprints. Hand-made landmarks,
24
+ vehicles and props must sit beside those procedural shells without looking like they came from
25
+ a different game.
26
+
27
+ ## The five rules
28
+
29
+ 1. **Recognizable shape first.** Silhouette, proportion and two or three identity features carry
30
+ recognition, not surface detail. The P-51 is unmistakably a P-51, like a good model-railroad
31
+ P-51: correct planform, spinner and canopy, chunky but true. If a model is not recognizable
32
+ with textures off and flat-shaded, more detail will not fix it.
33
+ 2. **Shared, low-frequency textures.** Surfaces use a small library of shared 256² material
34
+ graphs tinted by palette, never a unique texture per building. Hundreds of distinct models
35
+ then cost a handful of textures.
36
+ 3. **Fit any footprint.** Procedural buildings are generated from whatever outline the map
37
+ supplies: L-shapes, courtyards, slivers and curves. A style has to stay coherent on all of
38
+ them, so it is built from simple, rule-driven parts.
39
+ 4. **Low-poly with levels of detail.** Cars are a little chunky, trees show their facets, and
40
+ buildings carry few adornments. LODs add detail as the camera approaches. High-priority
41
+ entities, such as the vehicle the player is in, earn more polygons than ambient copies.
42
+ 5. **Three rendering modes.** Economy, Medium and High (see
43
+ [Rendering modes](#rendering-modes)) change resolution, shadows and level of detail. They
44
+ never change the palette or the style, so every mode looks like the same world.
45
+
46
+ ## The look the engine provides
47
+
48
+ Author against the lighting the Earth view actually uses. Both Earth hosts share one rig:
49
+ `mountEarthView`, and viewers that compose their own, such as the World Explorer. The rig is
50
+ exported from `@bendyline/molen-earth/client` as `EARTH_SKY_PALETTE`, `EARTH_LIGHTING`,
51
+ `EARTH_TONE_MAPPING`, `EARTH_EXPOSURE`, `EARTH_WATER_COLOR` and `earthHazeColor`.
52
+
53
+ | Element | Value | What it means for an asset |
54
+ | --- | --- | --- |
55
+ | Sun | Warm white `#fff1d8`, intensity 3.5 | Sunlit horizontal faces render near their authored color |
56
+ | Sky fill | `dayAmbient` 2 from the sky dome, warm ground bounce `#7a7258` | Faces in shade sit at roughly a third of lit faces, cool-tinted |
57
+ | Tone mapping | Khronos PBR Neutral, exposure 1 | Authored colors keep their hue and saturation below the highlights |
58
+ | Cast shadows | On from the Medium tier up, in a shadow map that follows the camera | Do not bake shadows or ambient occlusion into colors or textures |
59
+ | Sky | Saturated zenith `#2f7fd3` over a pale horizon `#c4dcec` | Large pure-white surfaces outshine it; prefer off-whites and creams |
60
+ | Haze | The sky's own horizon color, from about 2 km | Distant ground dissolves into the horizon; do not add a fog color of your own |
61
+ | Water | `#286d83` with a soft sky reflection | Lakes and bays read clearly blue, never grey |
62
+
63
+ Two consequences matter for authoring:
64
+
65
+ - **Walls receive less light than roofs.** Under a high sun a vertical wall gets about half the
66
+ light a roof gets. A wall palette therefore needs to be lighter than the color you want to see.
67
+ - **Shadows do the grounding.** A building, tree or car is seated by its cast shadow. Never fake
68
+ contact shading with a dark gradient or soot band at the base of a model; a foundation is its
69
+ own material, not a shadow.
70
+
71
+ ### Color spaces
72
+
73
+ Getting color spaces wrong is the most common reason a model looks washed out or muddy next to
74
+ its neighbors.
75
+
76
+ - **Hex palettes are sRGB.** Archstyle palettes, scatter surface colors, terrain bands, landmark
77
+ manifests and identity colors are sRGB hex. The client decodes them to linear before the GPU
78
+ sees them, so a swatch renders as that swatch.
79
+ - **glTF vertex colors (`COLOR_0`) and `baseColorFactor` are linear.** Writing `[0.5, 0.5, 0.5]`
80
+ gives the light grey `#bcbcbc`; the mid grey `#808080` is linear `0.216`. Convert from sRGB
81
+ when you move a palette color into a GLB.
82
+ - **Base-color textures are sRGB; normal, roughness, metalness and occlusion maps are linear.**
83
+ - **Multiply tinting darkens.** A palette tint multiplies its material graph. The shared siding,
84
+ render and shingle graphs average about 0.85 in sRGB (0.65 linear), so a tinted surface renders
85
+ about 15% darker than its swatch. Author tints a step lighter, or keep a graph near white.
86
+ Distant flat levels and loading placeholders multiply by the same mean
87
+ (`TEXTURED_SURFACE_MEAN`), so a building's brightness holds as its detail changes; a new
88
+ graph far from that mean will brighten or darken visibly at the switch.
89
+
90
+ ## Color and palette
91
+
92
+ The palette is vivid and coherent. Use clear, pleasant hues in a narrow band of lightness for
93
+ each kind of surface. Avoid both grey-on-grey and candy color.
94
+
95
+ | Surface | HSL lightness | HSL saturation | Reference swatches |
96
+ | --- | --- | --- | --- |
97
+ | Painted wall, siding, render | 60–90% | 15–60% | sage `#a3b78f`, slate blue `#8199b2`, cream `#efe3c4`, butter `#e6cf86` |
98
+ | Masonry, brick, timber walls | 45–65% | 25–45% | brick `#a8634b`, sandstone `#c9ab84`, cedar `#a77a54` |
99
+ | Pitched roof (shingle, tile, slate) | 35–50% | 6–40% | charcoal `#575c62`, brown `#725c49`, moss `#5a6d55`, terracotta `#a5644b` |
100
+ | Flat roof (membrane, gravel) | 62–80% | 0–12% | gravel `#a9a59c`, membrane `#c4c0b6` |
101
+ | Trim and frames | 85–95% or 22–30% | 0–30% | white `#f4f1ea`, dark frame `#3b3e42` |
102
+ | Untextured window glass | 35–45% | 20–30% | blue-grey pane `#4d6178` |
103
+ | Lawn and residential ground | 45–55% | 25–35% | lawn `#8aa065`, grass `#7fa258`, park `#6c9a55` |
104
+ | Paved and commercial ground | 60–70% | 5–12% | paving `#aaa59a` |
105
+ | Forest floor and conifers | 30–40% | 25–35% | forest `#3c6a3f`, fir `#3e7052` |
106
+ | Asphalt | 25–32% | 0–10% | road `#41484d`, with markings `#eee9d4` and `#e8bd57` |
107
+ | Identity and wayfinding accents | 35–60% | 55–90% | signal red `#b81d18`, chrome yellow `#e7b52a` |
108
+
109
+ Palette rules:
110
+
111
+ - **Give a third of a palette a clear hue.** At least a third of a wall palette's weight should be
112
+ colors with saturation of 25% or more, so a street of procedural houses never reads as grey
113
+ concrete. Neutrals (whites, creams, greys) are welcome, but not as the majority.
114
+ - **No black and no white on large surfaces.** Large surfaces stay between 22% and 94% lightness.
115
+ A near-black roof reads as a hole in the frame, and a pure white wall blooms in sun.
116
+ - **Roofs are darker than walls; flat commercial roofs are lighter.** Pitched roofs sit 15–35
117
+ lightness points below their walls, so a neighborhood seen from above reads as roofs. Large
118
+ flat roofs are light membranes and gravel, as they are in reality.
119
+ - **Reserve saturated accents.** Strong saturation belongs to identity: a store's sign band, a
120
+ landmark's signature color, a bus livery, a fire station. Use one accent per object.
121
+ - **Real landmarks use their real colors.** The Tacoma Narrows towers are green and the Golden
122
+ Gate is International Orange. A generic recipe must never repaint a known structure.
123
+ - **Jitter gently.** Per-building variation of ±0.012 hue, ±0.05 saturation and ±0.05 lightness
124
+ keeps a street from looking cloned without drifting out of the palette.
125
+ - **Regional palettes stay in band.** A desert region is warmer and a Japanese street is cooler
126
+ and darker-roofed, but every region uses the same lightness bands.
127
+
128
+ ## Geometry and polygon budgets
129
+
130
+ Budgets are per model and per level of detail. The scene and tile budgets in
131
+ [adaptive rendering performance](adaptive-performance.md) still decide how many instances fit.
132
+
133
+ | Asset | Near | Medium | Far |
134
+ | --- | --- | --- | --- |
135
+ | Procedural building | Style tier 0: roof, windows, trim, dormers, props | Tier 1: roof and windows, no trim or props | Tier 2 or an instanced stand-in box |
136
+ | Landmark or authored structure | Closeup ≤ 64,000 | Street ≤ 16,000, district ≤ 4,000 | Skyline ≤ 1,000 |
137
+ | Small static building | 1,000–8,000 | 500–2,000 | Box or silhouette ≤ 200 |
138
+ | Hero vehicle (player car, aircraft) | 10,000–60,000 | 5,000–15,000 | ≤ 2,000 |
139
+ | Ambient car or bus | ≤ 2,000 drawn | — | Proxy ≤ 160 |
140
+ | Tree | 240–450 | 120–140 | 12–20 |
141
+ | Street furniture (lamp, bench, rack) | 50–500 | 50–150 | 36–72 or none |
142
+ | Ground cover (tussock, fern, stone) | 20–70 | None | None |
143
+ | Figure (person or animal) | 1,000–4,000 | 600–900 | 100–300 rigid |
144
+
145
+ Geometry rules:
146
+
147
+ - **Flat shading.** Every face reads as a plane, with hard normals on architecture, vehicles and
148
+ vegetation alike. Use smooth normals only on intentionally round forms, such as a fuselage, a
149
+ dome or a storage tank, and give them enough sides that the silhouette stays clean.
150
+ - **Facet counts.** Cylinders and cones get 6–8 sides far, 12–16 near and 24–32 on a hero
151
+ model. Spheres and domes follow the same rings. An octagonal column reads as round at street
152
+ distance.
153
+ - **Nothing thinner than it can draw.** At the distance a level is used, an element must be at
154
+ least a pixel or two wide. Cables, mullions, railings, guy wires and lattice members that fall
155
+ below that move into a texture, merge into a solid panel, or drop out of that level. Sub-pixel
156
+ geometry shimmers and costs as much as solid geometry.
157
+ - **No micro-bevels.** Chamfer only the largest edges of a hero model, and only once.
158
+ - **One draw per material.** Merge a model's parts by material. Two to five materials is
159
+ typical; more than eight needs a reason.
160
+ - **Instance repeats.** Seats, windows, bollards, lamps and trees are instanced or merged, never
161
+ thousands of separate meshes.
162
+ - **Ground contact.** The base sits at Y=0, or on a declared attachment plane, with no floating
163
+ gap and no deep embedding.
164
+
165
+ ## Textures and materials
166
+
167
+ - Use the shared material graphs in the default style pack (brick, siding, render, concrete,
168
+ shingle, tile, slate, metal, glazing) before adding one. Their
169
+ [catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md)
170
+ lists repeat sizes and intended use.
171
+ - Textures are 256² seamless and low contrast, with true physical repeats: a 2 m facade holds
172
+ 2 m of brick courses, not two giant bricks.
173
+ - A material graph that will be tinted averages near white (sRGB 0.85 or above), so palettes
174
+ keep their meaning.
175
+ - Never bake directional light, shadows, ambient occlusion or dirt gradients into base color.
176
+ - Glass is a dark blue-grey pane with a modest reflection, not a mirror. Identity lettering is
177
+ geometry or vertex color, not a texture per business.
178
+ - Photographs from research are evidence, not textures, and never ship inside a model.
179
+
180
+ ## Procedural buildings that fit any footprint
181
+
182
+ A style is a set of rules applied to arbitrary outlines, so its parts must survive every shape:
183
+
184
+ - **Build from the outline.** Walls extrude from the footprint. Bays repeat at 2.6–4 m along each
185
+ wall, and windows sit in those bays. Nothing assumes a rectangle.
186
+ - **Have a roof fallback.** Gable and hip roofs apply only where the footprint analysis allows
187
+ them; anything else falls back to a flat roof with a parapet. The fallback must look as
188
+ intentional as the main roof.
189
+ - **Keep details sparse and local.** Porches, dormers, balconies and shutters attach to
190
+ qualifying walls and stop cleanly at corners, seams and courtyards. A detail that would cross
191
+ a clipped edge is skipped.
192
+ - **Respect mapped data.** Keep the footprint, height, levels and minimum height. Missing height
193
+ falls back to a conservative default for the category, not to the style's tallest form.
194
+ - **Declare the LOD tiers.** Each style lists which feature groups survive at tiers 0, 1 and 2,
195
+ so distant buildings keep their roof shape and window rhythm after trim and props drop.
196
+
197
+ The [worldgen guide](worldgen.md) and the
198
+ [structure library](structure-library.md) cover the archstyle format and the 120 shipped styles.
199
+
200
+ ## Landmarks and authored structures
201
+
202
+ A landmark earns its own model because people know it. Spend its budget on recognition, in this
203
+ order:
204
+
205
+ 1. **Three identity features at skyline distance.** For the Space Needle that is the hourglass
206
+ legs with a narrow waist, the flared halo of the top house, and the spire. For a suspension
207
+ bridge it is the tower shape, the cable sag and the deck color. For a stadium it is the roof
208
+ form and the bowl outline. The 1,000-triangle skyline level must still show all three, so
209
+ author it by hand when automatic simplification loses them.
210
+ 2. **Correct proportion and massing** at the district level, with up to 4,000 triangles.
211
+ 3. **Rhythm and openings** (window bands, arches, truss bays) at street level, with up to 16,000.
212
+ 4. **Selected detail** close up, with up to 64,000. More than that needs a written reason, and
213
+ the levels below it must still meet their own targets.
214
+
215
+ Runtime levels come from the engine repository's landmark LOD generator, which meets these
216
+ targets for you where it can. It simplifies each level at its natural error first; if that
217
+ leaves the level more than 15% over target, it raises the error budget and prunes isolated parts
218
+ (seat rows, mullions, cables) until the level fits, up to 2% of the model's extent for district,
219
+ 0.6% for street and 0.15% for closeup. A closeup that still does not fit stays over target
220
+ rather than blur; that is a master to re-author, not a level to force. A master already under
221
+ the closeup target ships as its own closeup only if it draws in 12 calls or fewer (an instanced
222
+ mesh counts once per primitive); otherwise it gets the material-merged derivative. The audit
223
+ `node packages/tooling/scripts/check-medium-fi.mjs` (in the engine repository) reports level
224
+ budgets, material counts, draw calls and near-black or pure-white surfaces for every structure.
225
+
226
+ Further rules:
227
+
228
+ - **Signature color.** Use the structure's documented paint and cladding colors, converted to
229
+ linear for `COLOR_0`.
230
+ - **Repeated structural members.** Model a stadium's seat tiers as stepped bands, not
231
+ individual seats (the stadium generators' `seatBand` draws a row as one band per aisle
232
+ section). Model truss and lattice work as a few members plus a texture or panel, and
233
+ cables as a few thick strands that thin out by level.
234
+ - **Nothing below the closeup's error.** The closeup level may drop detail smaller than 0.15% of
235
+ the model's extent (about 40 cm on a 260 m tower), so do not author it: 3–7 cm window frames,
236
+ stone joints, baluster rails and glazing bars on a tall building never reach the screen, and
237
+ the generator cannot remove them for you, because each one is a closed little part.
238
+ - **Draw a curtain wall once.** A facade of framed cells is one glass face with its mullions as
239
+ full-length strips just proud of it (the signature-tower `grid` and `facetedGlazing` helpers),
240
+ not an inset pane and frame ring per cell. Per-cell panels made towers carry 300,000 to
241
+ 1,000,000 triangles that no level could simplify; as one face the same wall is a few hundred
242
+ and looks the same.
243
+ - **Sit in the palette.** A landmark is the most saturated thing in its block only where its
244
+ real color demands it.
245
+
246
+ ## Ground
247
+
248
+ Large map polygons (a lawn, a meadow, a forest floor) are one color edge to edge, so the ground
249
+ gets variation from two cheap sources rather than from per-polygon textures:
250
+
251
+ - **The ground shader.** `createTerrainGroundMaterialAsync` from `@bendyline/molen-terrain/client`
252
+ multiplies terrain and landcover vertex colors by world-space value noise: broad 64 m mottling,
253
+ 16 m patches, 4 m clumps and 1 m grain, plus straw-colored dry areas and darker lush ones on
254
+ green ground only, so paving, sand and rock keep their hue. Finer layers fade out before they
255
+ fall below a pixel. It costs no geometry, texture or upload. The Earth view uses it by default;
256
+ the World Explorer's `?ground=flat` turns it off for comparison.
257
+ - **Ground cover.** Knee-high tussocks, ferns, small shrubs and stones from scatter rules on the
258
+ `groundcover` layer (see [worldgen](worldgen.md)). They draw near the camera only, under 70
259
+ triangles each, from their own budget so they never thin the trees, and not at Economy quality.
260
+
261
+ New ground palettes stay inside the lawn and forest bands in the palette table: the shader
262
+ already brightens and darkens them by about ±12% and tints dry patches toward straw.
263
+
264
+ ## Vehicles, aircraft, trees and figures
265
+
266
+ - **Hero entities get more.** The car or aircraft the player controls may use the high end of
267
+ its budget, smooth hulls where the real object is curved, and an interior. Ambient copies of
268
+ the same type use a lower level of detail and a proxy at distance.
269
+ - **Vehicles are chunky but true.** Wheel arches, glasshouse and stance carry the type. Paint is
270
+ one shared material with per-instance color from a palette of real car colors. Glass is one
271
+ dark material.
272
+ - **Trees are faceted.** Use 6–12-sided conifers and icosahedral crowns with flat shading, a
273
+ slightly darker base, and varied heights. Never use alpha-card foliage.
274
+ - **Figures stay stylized.** Mitten hands, disc eyes and block shoes keep them out of the uncanny
275
+ valley; see [figures](figures.md).
276
+
277
+ ## Rendering modes
278
+
279
+ The adaptive controller picks one of six tiers from measured frame times. They group into three
280
+ modes. Every mode keeps the same palette and style; only cost changes.
281
+
282
+ | Mode | Tiers | Resolution | Sun shadows | Objects | What it is for |
283
+ | --- | --- | --- | --- | --- | --- |
284
+ | Economy | Minimum, Low | 50–65% scale, ≤ 0.7 megapixels | Off | Simplified procedural tiers, stand-in boxes sooner, 6–8 px LOD error | Phones, weak integrated GPUs, software rendering |
285
+ | Medium | Medium, Balanced | 80–100% scale, ≤ 1.8 megapixels | Medium, then high | Balanced worldgen preset, 2.5–4 px error | Typical laptops |
286
+ | High | High, Ultra | 100–125% scale, ≤ 4 megapixels | High | Full detail, 1.5–2 px error | Discrete GPUs and capture |
287
+
288
+ Economy has no cast shadows, so it must still look good without them. That is one more reason to
289
+ keep roofs darker than walls and to avoid baked shading. Hosts choose a fixed mode with
290
+ `quality: 'economy' | 'balanced' | 'high'`, or let `'auto'` adapt; see
291
+ [adaptive rendering performance](adaptive-performance.md).
292
+
293
+ ## Review before submitting
294
+
295
+ Run this review for every new or changed model, style or palette. A successful build is not a
296
+ visual approval.
297
+
298
+ 1. **Silhouette.** Render with textures off and flat shading. Name the object from the
299
+ silhouette alone, at skyline distance.
300
+ 2. **Budget.** Record triangles, materials and draw calls per level, and check them against the
301
+ tables above. A level far over target usually means the master repeats a framed part per
302
+ cell or per floor; find the helper that emits most of the triangles before tuning anything.
303
+ 3. **Palette.** Every large surface falls inside its band. Hex palettes are sRGB, and colors
304
+ moved into a GLB are converted to linear.
305
+ 4. **Context.** View the model in an Earth scene beside procedural buildings at three distances
306
+ (street, block, skyline), and at noon and late afternoon. It should look like it belongs.
307
+ Neither the brightest nor the dullest thing in the frame, unless it is meant to be.
308
+ 5. **Modes.** Check the Economy mode (no shadows) as well as High.
309
+ 6. **Distance behavior.** Watch the switches between levels for popping, shimmer on thin parts,
310
+ and floating or sinking at the base.
311
+
312
+ Useful captures from a project:
313
+
314
+ ```sh
315
+ npx molen asset shot assets/my-model/asset.json --out-dir review --angles 8 # one asset, eight angles
316
+ npx molen worldgen preview my.archstyle.json --out style.png # a style on sample footprints
317
+ npx molen figure preview --preset human.adult --angles review --out figure.png
318
+ ```
319
+
320
+ In the engine repository, the World Explorer is the reference scene. Its structure sheet renders
321
+ all 120 styles under the same light, `node examples/world-explorer/scripts/capture-structure-sheet.mjs`.
322
+
323
+ ## Read next
324
+
325
+ - [3D art guidelines](3d-art-guidelines.md): scale, pivots, the material library and review captures
326
+ - [3D model assets](3d-model-assets.md): prompt-to-glTF authoring, import and hosting
327
+ - [Worldgen](worldgen.md): archstyles, palettes and LOD tiers in detail
328
+ - [Earth view](earth-view.md): the host these rules are written for
@@ -68,6 +68,14 @@ npx molen pack fetch https://molen.dev/packs/index.json molen.entities # just
68
68
  the project's `packs`, so the project keeps working offline and a later re-publish never changes
69
69
  it underneath you. A browser app serves the same zips from wherever it hosts its static files.
70
70
 
71
+ molen.dev lists the core packs only. The default style pack's landmark models (regional model
72
+ archives, several GB in all) are on the rolling
73
+ [`packs` release](https://github.com/bendyline/molen/releases/tag/packs) with every other pack:
74
+ `npx molen pack fetch https://github.com/bendyline/molen/releases/download/packs/index.json
75
+ <ids…>`. A browser can't read those downloads directly (GitHub sends no CORS headers); host the
76
+ zips yourself, or read the unzipped copy at `https://qualla.com/_a/index.json`. Without its model
77
+ archives, the style pack draws landmarks as procedural buildings.
78
+
71
79
  A project lists the packs it uses, in order, and their types join the registry like the
72
80
  project's own:
73
81
 
@@ -106,7 +106,9 @@ lighting changes visibly; moving the camera does not rebuild it. It is enabled b
106
106
  `mountEarthView` and the world explorer. General viewers keep the legacy default (`false`).
107
107
  The approximation provides sky reflections, not reflections of nearby buildings or trees.
108
108
  Without `environment.sky`, it uses the ambient/sun rig and background color. Its filtered map
109
- replaces the hemisphere's diffuse contribution during rendering to avoid lighting surfaces twice.
109
+ replaces the hemisphere's diffuse contribution during rendering to avoid lighting surfaces twice,
110
+ and carries the same irradiance: `sky.lighting.dayAmbient` and `nightAmbient` (or
111
+ `environment.ambient.intensity`) set the sky fill whether reflections are on or off.
110
112
  A host-supplied `renderer.scene.environment` takes precedence; the host retains ownership of that
111
113
  texture and control of its light balance.
112
114
  Custom host meshes should use `MeshStandardMaterial` or `MeshPhysicalMaterial` for this mode;