@bendyline/molen-tooling 0.0.11 → 0.0.13
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/capture/harness.js +682 -293
- package/dist/capture/worldgen-preview.js +396 -298
- package/dist/cli.mjs +2 -2
- package/dist/docs-src/guide/3d-art-guidelines.md +34 -10
- package/dist/docs-src/guide/3d-model-assets.md +27 -2
- package/dist/docs-src/guide/adaptive-performance.md +42 -7
- package/dist/docs-src/guide/aircraft.md +249 -27
- package/dist/docs-src/guide/ambient-life.md +28 -5
- package/dist/docs-src/guide/audio.md +19 -5
- package/dist/docs-src/guide/boats.md +9 -4
- package/dist/docs-src/guide/boost-mode.md +64 -0
- package/dist/docs-src/guide/building-interiors.md +7 -2
- package/dist/docs-src/guide/determinism.md +1 -1
- package/dist/docs-src/guide/dioramas.md +17 -4
- package/dist/docs-src/guide/earth-view.md +225 -24
- package/dist/docs-src/guide/entities.md +87 -5
- package/dist/docs-src/guide/figures.md +31 -7
- package/dist/docs-src/guide/graphics-performance.md +203 -24
- package/dist/docs-src/guide/input.md +34 -1
- package/dist/docs-src/guide/liveries.md +167 -0
- package/dist/docs-src/guide/livery-catalog.md +2659 -0
- package/dist/docs-src/guide/livery-gallery.md +2684 -0
- package/dist/docs-src/guide/medium-fi.md +279 -27
- package/dist/docs-src/guide/navigation.md +5 -2
- package/dist/docs-src/guide/night-lighting.md +96 -0
- package/dist/docs-src/guide/project.md +6 -1
- package/dist/docs-src/guide/recognizable-places.md +6 -0
- package/dist/docs-src/guide/regional-fleets.md +94 -0
- package/dist/docs-src/guide/regional-world.md +19 -6
- package/dist/docs-src/guide/rendering-backends.md +6 -2
- package/dist/docs-src/guide/sky.md +36 -3
- package/dist/docs-src/guide/structure-library.md +4 -1
- package/dist/docs-src/guide/surface-rendering.md +276 -2
- package/dist/docs-src/guide/terrain.md +43 -0
- package/dist/docs-src/guide/typography.md +105 -0
- package/dist/docs-src/guide/vehicle-interiors.md +169 -9
- package/dist/docs-src/guide/vehicles.md +26 -3
- package/dist/docs-src/guide/weather.md +15 -8
- package/dist/docs-src/guide/worldgen.md +100 -13
- package/dist/docs-src/llms.txt +9 -1
- package/dist/docs-src/schemas/README.md +3 -0
- package/dist/docs-src/schemas/archstyle.md +65 -0
- package/dist/docs-src/schemas/components.md +2009 -213
- package/dist/docs-src/schemas/fleet-catalog.md +113 -0
- package/dist/docs-src/schemas/landmark.md +10 -0
- package/dist/docs-src/schemas/matgraph.md +11 -1
- package/dist/docs-src/schemas/pack-source.md +11 -1
- package/dist/docs-src/schemas/pack.md +1 -1
- package/dist/docs-src/schemas/project.md +1 -1
- package/dist/docs-src/schemas/regional-catalog.md +39 -0
- package/dist/docs-src/schemas/scatter.md +36 -0
- package/dist/docs-src/schemas/structure-placement-data.md +753 -0
- package/dist/docs-src/schemas/structure-placement-index.md +87 -0
- package/dist/docs-src/schemas/structure-placements.md +274 -0
- package/dist/docs-src/schemas/transport-network.md +8 -0
- package/dist/docs-src/schemas/types.md +1 -1
- package/dist/docs-src/schemas/worldgen-batch.md +145 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1 -1
- package/dist/{mcp-BbxqqnD1.mjs → mcp-BXaK46X-.mjs} +1 -1
- package/dist/{ops-b4Pag8U-.mjs → ops-Cm7WNvb9.mjs} +55 -22
- package/dist/templates/city-courier/gen/molen-types.ts +240 -17
- package/dist/templates/city-courier/scripts/molen-scripts.d.ts +240 -17
- package/dist/templates/figures-gallery/test/headless.test.ts +2 -1
- package/dist/templates/index.json +17 -17
- package/dist/templates/skybound/gen/molen-types.ts +240 -17
- package/dist/templates/skybound/scripts/molen-scripts.d.ts +240 -17
- package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +240 -17
- package/dist/templates/top-down-arena/src/gen/molen-types.ts +240 -17
- package/package.json +13 -13
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Regional vehicle fleets
|
|
2
|
+
|
|
3
|
+
Earth traffic and parked cars share a small fleet catalog. It assigns relative weights to existing
|
|
4
|
+
vehicle type IDs and contains no models. China, Japan, Korea, several European, South American and
|
|
5
|
+
African markets, and North America have separate mixtures. These are visual approximations, not
|
|
6
|
+
sales or registration statistics. Unknown areas use a global fallback. Aircraft and ships keep
|
|
7
|
+
their independent global pools.
|
|
8
|
+
|
|
9
|
+
## Content and selection
|
|
10
|
+
|
|
11
|
+
Publish `molen/fleet-catalog@1` documents through `provides.fleet` in a content pack. The stock
|
|
12
|
+
catalog is `content/entities/fleets/road.json`. Each has `id`, integer `version`, `description`,
|
|
13
|
+
`fallback`, atlas `regions` bindings, and named `profiles` with `title`, optional `extends`, and
|
|
14
|
+
`weights`. All parents and bindings in a standalone document must resolve. Positive weights are
|
|
15
|
+
relative prevalence; zero excludes an inherited model. Missing models are filtered against the
|
|
16
|
+
loaded type library. Cycles and duplicate profile IDs or region bindings are rejected.
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"format": "molen/fleet-catalog@1",
|
|
21
|
+
"id": "example.fleet",
|
|
22
|
+
"version": 1,
|
|
23
|
+
"description": "Illustrative road mix",
|
|
24
|
+
"fallback": "global",
|
|
25
|
+
"regions": { "library.china": "china" },
|
|
26
|
+
"profiles": [
|
|
27
|
+
{ "id": "global", "title": "Global", "weights": { "example.compact": 1 } },
|
|
28
|
+
{ "id": "china", "title": "China", "extends": "global", "weights": {
|
|
29
|
+
"example.seagull": 12, "example.qin": 10, "example.compact": 0.5
|
|
30
|
+
} }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
`createFleetLibrary` from `@bendyline/molen-ambient/kernel` resolves inheritance and makes a stable
|
|
36
|
+
weighted shortlist: default 16 distinct models per profile, retaining the four most common types
|
|
37
|
+
and sampling the rest without replacement. The profile name seeds selection; camera movement,
|
|
38
|
+
download completion and property order do not change it. Paint palettes add variety without more
|
|
39
|
+
geometry. A model can appear in many profiles through the same asset ID.
|
|
40
|
+
|
|
41
|
+
`loadEarthContent` reads fleet metadata and the Earth atlas even when architectural styling is
|
|
42
|
+
disabled. `createEarthFleet` from `@bendyline/molen-earth` resolves only fleet-bound atlas regions,
|
|
43
|
+
so a local architectural overlay cannot hide its country's fleet. Moving traffic chooses at its
|
|
44
|
+
spawn position. Parking chooses at the terrain tile center and passes weighted specifications and
|
|
45
|
+
colors into both synchronous and worker generation; border parking follows the tile's profile.
|
|
46
|
+
Existing traffic changes naturally through despawning, without replacing a car being watched.
|
|
47
|
+
|
|
48
|
+
`mountEarthView` wires this automatically. Set `fleet: { maxModels: 12 }` for a smaller shortlist
|
|
49
|
+
(valid range 1–128). Custom hosts pass `fleet.carsAt` to `EarthAmbient`/`installAmbient`, and
|
|
50
|
+
`fleet.parkedAt` as the third argument of `createTerrainSurfaceRenderer`. Hosts without fleet
|
|
51
|
+
content retain their original behavior.
|
|
52
|
+
|
|
53
|
+
## Downloads and residency
|
|
54
|
+
|
|
55
|
+
World Explorer builds an entity archive for distribution and a versioned directory manifest for
|
|
56
|
+
browser use. The index points to `molen-pack.json`, so even a static server without HTTP Range
|
|
57
|
+
downloads only requested GLBs. Opening the catalog fetches no GLBs; distant traffic and parking
|
|
58
|
+
use instanced proxies. Explicit player selection may load any vehicle. Node pack hosting also
|
|
59
|
+
accepts a hosted directory index. Content hashes identify shared files in the Earth byte cache.
|
|
60
|
+
|
|
61
|
+
Directory reads share transfers. Cancelling one reader preserves another reader's request; when
|
|
62
|
+
the last reader cancels, queued or active work is aborted. Failed/aborted reads can retry. The
|
|
63
|
+
directory pack's byte cache defaults to 16 MiB with least-recently-used eviction. Browser HTTP and
|
|
64
|
+
IndexedDB storage are separate from decoded Three.js models.
|
|
65
|
+
|
|
66
|
+
The ambient detailed vehicle pool defaults to four idle instances, two concurrent loads and
|
|
67
|
+
32 MiB of estimated geometry/decoded-texture buffers. Active count also respects `detailedCars`.
|
|
68
|
+
Cars and boats have separate bounded pools. Idle instances are evicted least recently used first;
|
|
69
|
+
a model that would exceed the byte budget stays a proxy. Eviction disposes geometry, material
|
|
70
|
+
clones and textures; late loads after cancellation or disposal are discarded. GPU bookkeeping,
|
|
71
|
+
JS object overhead and temporary decoding allocations are outside this estimate, so it is a
|
|
72
|
+
residency budget rather than a process-wide memory ceiling.
|
|
73
|
+
|
|
74
|
+
Configure `idleVehicleModels`, `vehicleModelBytes`, and `vehicleLoads` on `EarthAmbientSettings`
|
|
75
|
+
or `AmbientRenderBudget`. Zero idle retention is supported. Parking independently loads at most
|
|
76
|
+
eight nearby detailed cars with two background requests. Driven cars retain simulation state but
|
|
77
|
+
release their model outside the near set. The mounted car and explicitly host-owned cars are
|
|
78
|
+
exceptions, owned until removal. Aircraft keep their existing budget.
|
|
79
|
+
|
|
80
|
+
## Coverage and authoring
|
|
81
|
+
|
|
82
|
+
The initial expansion adds 24 shared models, predominantly 2024 plus the 2025 four-door Wuling
|
|
83
|
+
Hongguang MINI EV. Profiles also reuse older and US-market models. Country-specific trim,
|
|
84
|
+
steering variants, fleet age distributions and local commercial coverage remain approximate.
|
|
85
|
+
The atlas groups the Korean peninsula; that fleet profile primarily represents South Korea.
|
|
86
|
+
Some shared models use export-market bodies or steering layouts. Road driving side comes from
|
|
87
|
+
Earth's country sign geography, shared by traffic, markings and signals; an explicit ambient
|
|
88
|
+
`drivingSide` overrides it. Fleet prevalence does not change traffic rules. Unbound regions fall back.
|
|
89
|
+
|
|
90
|
+
Add a model once and reference its ID in appropriate profiles. Preserve older cars and several
|
|
91
|
+
body classes. Every drivable model follows [Medium-fi](medium-fi.md) close-view requirements:
|
|
92
|
+
clear driver sightlines, modeled cabin and controls, named moving wheels/steering, glazing,
|
|
93
|
+
coherent lamps and panel details. Keep bulk captures local. The entities pack's
|
|
94
|
+
`REGIONAL-VEHICLES.md` and `regional-vehicles-review.json` hold the roster and hash-bound review.
|
|
@@ -51,7 +51,9 @@ cells are visible in generation diagnostics and do not receive invented wild veg
|
|
|
51
51
|
|
|
52
52
|
Bare and distant terrain receives the same ecological ground palette before detailed map
|
|
53
53
|
surfaces arrive. `createRegionalGroundColor` supplies the terrain stream's optional
|
|
54
|
-
`surfaceColor` callback
|
|
54
|
+
`surfaceColor` callback (with an optional `colorTile` method that colors a whole tile's arrays in
|
|
55
|
+
one call, which Earth's regional palette provides: per-vertex calls boxed a quarter of a million
|
|
56
|
+
arguments per tile on the main thread); it runs before upload for both worker-prepared and local meshes and
|
|
55
57
|
returns linear RGB. An explicit host `style.ground` palette takes precedence in `mountEarthView`.
|
|
56
58
|
Nature-reserve, national-park and protected-area designations retain their protection metadata,
|
|
57
59
|
but do not paint over the physical habitat beneath them. With no mapped physical cover, sparse
|
|
@@ -187,7 +189,7 @@ at high latitudes. Tropical locations stay leaf-on; evergreen plants do not beco
|
|
|
187
189
|
does not infer local weather, snow, tropical wet/dry seasons, crop harvest dates, or climate change.
|
|
188
190
|
Remount with another month to change appearance.
|
|
189
191
|
|
|
190
|
-
The ordinary architectural catalog supplies
|
|
192
|
+
The ordinary architectural catalog supplies 294 recipes across 14 construction families and seven
|
|
191
193
|
uses: detached homes, attached homes, apartments, commercial, civic, industrial, and farm
|
|
192
194
|
buildings. Mapped use wins over neighborhood inference. Taller measured residential buildings
|
|
193
195
|
select compatible apartment recipes; source footprint, height, and levels still control the
|
|
@@ -199,6 +201,12 @@ identity selects their window/bay rhythm, roof weighting, eaves, parapets and su
|
|
|
199
201
|
details. The facade names do not resize the mapped building. Explicit original recipe IDs remain
|
|
200
202
|
available, and identity-free selection keeps the base recipe.
|
|
201
203
|
|
|
204
|
+
For inferred vacant lots, regional `lotPlans` weights select cottages, L-shaped ranches,
|
|
205
|
+
courtyards, compact homes, attached-garage plans or commercial shopfronts. The US Southwest has
|
|
206
|
+
its own stucco-and-ceramic-tile family; Washington uses the North American siding-and-shingle
|
|
207
|
+
family. Each inferred lot reserves a path or driveway to its frontage street. Mapped land use
|
|
208
|
+
selects residential versus commercial pools; see [building infill](worldgen.md#inferred-buildings-where-outlines-are-missing).
|
|
209
|
+
|
|
202
210
|
Near-detail ordinary facades include a bounded single, double, or service entrance. The inferred
|
|
203
211
|
entrance fits an eligible exterior wall, reserves a ground-floor window bay, and yields to known
|
|
204
212
|
structural openings, open ground floors, and raised buildings. It is a visual entrance; it does
|
|
@@ -335,10 +343,15 @@ dispose with the terrain stream. Tiny animals disappear at short distances.
|
|
|
335
343
|
|
|
336
344
|
An explicit vegetation month also suppresses the generic insect/lizard groups in the coarse
|
|
337
345
|
cold season and changes the arctic-fox coat. It does not simulate migration or actual weather.
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
346
|
+
Birdsong uses the sound pack's curated regional catalog when present: location, observed habitat,
|
|
347
|
+
the sky's calendar month and local sunlight select the recordings. The initial eight CC0
|
|
348
|
+
recordings cover conservative areas in North America, Europe, Japan, Australia, the Amazon,
|
|
349
|
+
South Africa and Mauritius; uncovered places stay quiet. Monthly gains are authored activity
|
|
350
|
+
priors, not a migration simulation. They are independent of the named visual mammal taxa.
|
|
351
|
+
Crickets still use the generic recording gated by regional habitat and season. Both retain
|
|
352
|
+
weather, height and vehicle suppression. Composing hosts supply `EarthAudioFrame.location`
|
|
353
|
+
and `regionalAmbience` from `EarthWildlife.ambience`; older packs without a birdsong catalog
|
|
354
|
+
retain the generic bird soundscape. See [Sound and music](audio.md).
|
|
342
355
|
|
|
343
356
|
## Authoring and verification in this repository
|
|
344
357
|
|
|
@@ -171,8 +171,12 @@ The world explorer also accepts `gpuOptimizations=0` for an uncached WebGPU comp
|
|
|
171
171
|
|
|
172
172
|
Open [World Explorer](https://molen.dev/play/world-explorer/), then compare the same location
|
|
173
173
|
and settings using [`?backend=webgpu`](https://molen.dev/play/world-explorer/?backend=webgpu) and
|
|
174
|
-
[`?backend=webgl`](https://molen.dev/play/world-explorer/?backend=webgl).
|
|
175
|
-
|
|
174
|
+
[`?backend=webgl`](https://molen.dev/play/world-explorer/?backend=webgl). World Explorer defaults
|
|
175
|
+
to WebGL, as the embedded Earth view does: WebGPU currently builds node state for every new
|
|
176
|
+
instanced mesh, which can leave terrain preparation behind a fast aircraft despite low GPU draw
|
|
177
|
+
times. Explicit `?backend=auto` still negotiates WebGPU with fallback; `?backend=webgpu` pins it
|
|
178
|
+
and enables its screen-space ambient occlusion. The general client/viewer default remains `auto`.
|
|
179
|
+
The performance HUD displays
|
|
176
180
|
the backend that actually rendered and any automatic fallback reason; its
|
|
177
181
|
`#performance-status` element also exposes `data-backend` and `data-fallback-reason` for tests.
|
|
178
182
|
|
|
@@ -85,7 +85,9 @@ These are client calculations using native floating-point math, outside the kern
|
|
|
85
85
|
|
|
86
86
|
When enabled, sky lighting replaces `environment.ambient` and `environment.sun`. Configure
|
|
87
87
|
`sky.lighting.sunIntensity`, `moonIntensity`, `dayAmbient`, `nightAmbient` and `castShadow`
|
|
88
|
-
instead.
|
|
88
|
+
instead. `skyLightSaturation` (0–1, default 1) sets how saturated the light the sky casts is
|
|
89
|
+
relative to the dome palette; below 1 it moves toward the palette's luminance, so a deep blue
|
|
90
|
+
zenith does not tint every surface in shade blue. The Earth view uses 0.3. Sunlight fades around the horizon; moonlight depends on altitude, phase and darkness.
|
|
89
91
|
Only the Sun casts a sky shadow in phase 1. Shadows also require `environment.shadows` and
|
|
90
92
|
scene geometry that casts/receives shadows; their local frustum follows the camera.
|
|
91
93
|
`renderer.setShadowQuality('off' | 'low' | 'medium' | 'high')` turns sun shadows on or off at a
|
|
@@ -97,6 +99,35 @@ shadow-map texels so edges do not shimmer; `setShadowFocus(undefined)` restores
|
|
|
97
99
|
light intensity to disable illumination. `sun.size` and `moon.size` are visual multipliers;
|
|
98
100
|
the default 1 preserves real angular size. Larger values help stylized scenes and small displays.
|
|
99
101
|
|
|
102
|
+
## Ambient occlusion
|
|
103
|
+
|
|
104
|
+
`renderer.setAmbientOcclusion(true, { radius, strength, reach })` adds screen-space ambient occlusion
|
|
105
|
+
(three's GTAO) on the WebGPU backend; on WebGL it does nothing. Creases, corners, window recesses
|
|
106
|
+
and the ground around building and tree bases darken where indirect light would not reach. The
|
|
107
|
+
frame then draws into an offscreen multisampled target exactly as it would to the canvas (the sky
|
|
108
|
+
scene, then the world, which also writes view normals packed in 8 bits); occlusion is computed
|
|
109
|
+
from that target's depth and normals at half resolution with eight samples, denoised at half
|
|
110
|
+
resolution too by a depth-aware 5×5 box (nine bilinear taps; it cancels GTAO's 5×5 rotation
|
|
111
|
+
pattern at a fraction of three's sixteen-tap denoiser), and multiplied into the image, with tone
|
|
112
|
+
mapping applied once at the end. Sky pixels (the far plane, with either depth convention) are left
|
|
113
|
+
untouched, and GTAO skips them: with a reversed depth buffer the sky reads as depth 1, the value
|
|
114
|
+
GTAO skips, rather than its stored 0. Anything farther than `reach` (default 250 m of view
|
|
115
|
+
distance) is skipped the same way, and the occlusion fades out over the last third of it: past
|
|
116
|
+
that its creases are under a pixel, and skipping them is most of an aerial view. `radius`
|
|
117
|
+
(default 3 m) is the world-space sampling radius and `strength` (0–1, default 0.85) the share
|
|
118
|
+
applied, since the
|
|
119
|
+
multiply also dims direct light. Frames draw directly while the pipeline compiles.
|
|
120
|
+
|
|
121
|
+
Every object's shaders are built for the target it draws into, and the occlusion target (it writes
|
|
122
|
+
normals beside color) is a different one from the canvas. With occlusion on, `prepareObject`
|
|
123
|
+
builds for the occlusion target. To skip the occlusion work for a while, call
|
|
124
|
+
`renderer.suspendAmbientOcclusion(true)` rather than turning it off: the frame keeps drawing into
|
|
125
|
+
the same target and copies the image out unshaded, so nothing is built again. Turning it off and on
|
|
126
|
+
with `setAmbientOcclusion` changes the target, and every object in view builds its shaders again,
|
|
127
|
+
mid-frame. The World Explorer suspends it above 24 m over the ground and resumes below 18 m, where
|
|
128
|
+
its creases are small but its passes still cost a full-screen share of each frame (about 3 ms of
|
|
129
|
+
a 44 ms rooftop frame on an Apple M2 at High); `?ao=0` turns it off for comparison.
|
|
130
|
+
|
|
100
131
|
## Reflections
|
|
101
132
|
|
|
102
133
|
For metal and glass, pass `reflections: true` to `createViewer` or `mountExperience`.
|
|
@@ -144,8 +175,10 @@ authored star list with `direction`, `magnitude`, and optional hex `color`.
|
|
|
144
175
|
Attach its `lights` group to the world scene, call `update(seconds)` and `prepareCamera(camera)`,
|
|
145
176
|
and render its `scene`/`camera` as a background pass before your scene. Dispose it when removed.
|
|
146
177
|
|
|
147
|
-
`palette` also accepts `ground`, `sun`, and `moon`. `
|
|
148
|
-
|
|
178
|
+
`palette` also accepts `ground`, `sun`, and `moon`. `dome.brightness` (default 1) scales only the
|
|
179
|
+
drawn dome, not the sky light or reflections taken from the palette: under filmic tone mapping a
|
|
180
|
+
clear sky lit at the palette's brightness renders pale, and the Earth look draws it at about half
|
|
181
|
+
(`EARTH_SKY_DOME`). `moon.earthshine` controls the dark side's subtle visibility. Stars support `enabled`, `magnitudeLimit` (up to the catalog limit of 6.5),
|
|
149
182
|
`intensity` and visual angular `size`. Stars disappear below the horizon and fade through
|
|
150
183
|
twilight; a bright visible Moon reduces their contrast. Moon disks occlude stars behind them.
|
|
151
184
|
|
|
@@ -92,7 +92,10 @@ priors and do not identify the architecture of an individual mapped building.
|
|
|
92
92
|
`facade.details` adds shutters, balconies, timber framing or pilasters, awnings and verandas.
|
|
93
93
|
Details use the actual facade rhythm, a bounded perimeter allocation, and the existing
|
|
94
94
|
`facade-bands` tier flag. Structural openings, clipped edges and courtyard constraints take
|
|
95
|
-
precedence.
|
|
95
|
+
precedence. Shutters, painted the dark tone of the trim, flank punched windows and, on houses with
|
|
96
|
+
walkable interiors, the structural window openings that replace them. A veranda wraps every
|
|
97
|
+
qualifying wall, so families whose lots sit close to the street leave it out. Dormers use
|
|
98
|
+
`roof.features.dormers` on eligible pitched wings. Simplified budget
|
|
96
99
|
representations omit ornament while retaining their footprint, primary roof and measured envelope.
|
|
97
100
|
|
|
98
101
|
The [standard material catalog](https://github.com/bendyline/molen/blob/main/content/worldgen/materials/README.md)
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Surface styles and parameterized line features
|
|
2
2
|
|
|
3
|
+
[Night lighting](night-lighting.md) adds dusk-driven lamp heads and pavement pools to modern
|
|
4
|
+
street fixtures, with separate lamp budgets and matching direct/worker output.
|
|
5
|
+
|
|
3
6
|
The terrain client renders roads, parking areas, pedestrian surfaces, and street fixtures from
|
|
4
7
|
normalized semantic tiles. World explorer exposes **Surfaces → Modern traffic / Circa 1910 /
|
|
5
8
|
Simple surfaces** in Human mode. Styles change in place, preserving the camera, streamed data,
|
|
@@ -30,6 +33,8 @@ const renderer = createDefaultTerrainSemanticRenderer({ surfaceRenderer: surface
|
|
|
30
33
|
await surfaces.setOptions({ style: '1910' });
|
|
31
34
|
// Call once per frame with absolute simulation time (seconds).
|
|
32
35
|
surfaces.updateSignals(tick / tickRate);
|
|
36
|
+
// And with the scene camera's world position: far tiles' small detail stops drawing.
|
|
37
|
+
surfaces.updateDetail(camera.position);
|
|
33
38
|
console.log(surfaces.stats());
|
|
34
39
|
// Dispose the stream/layers, then the shared controller when the experience closes.
|
|
35
40
|
surfaces.dispose();
|
|
@@ -82,6 +87,89 @@ budgets can call the stream's `refreshMemoryUsage()` after a new revision finish
|
|
|
82
87
|
Disposing the controller
|
|
83
88
|
also disposes its generator; do not share that generator between separately owned controllers.
|
|
84
89
|
|
|
90
|
+
## Pavement material
|
|
91
|
+
|
|
92
|
+
By default the surfaces draw in a plain vertex-color material. For textured asphalt, concrete and
|
|
93
|
+
paint, give the controller the pavement material for the renderer's backend once the renderer
|
|
94
|
+
exists; resident tiles switch in place and later tiles use it too:
|
|
95
|
+
|
|
96
|
+
```ts
|
|
97
|
+
import {
|
|
98
|
+
createTerrainPavementMaterialAsync,
|
|
99
|
+
setTerrainGroundOrigin,
|
|
100
|
+
} from '@bendyline/molen-terrain/client';
|
|
101
|
+
|
|
102
|
+
const pavement = await createTerrainPavementMaterialAsync({}, renderer.backend);
|
|
103
|
+
surfaces.setMaterial(pavement);
|
|
104
|
+
// Each frame, or whenever the floating origin moves, keep the pattern on the ground:
|
|
105
|
+
setTerrainGroundOrigin(pavement, [worldOrigin[0], worldOrigin[2]]);
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The material reads a `surfaceDetail` attribute the surface builder writes on every road, sidewalk,
|
|
109
|
+
curb, marking and lot: meters along the band, meters across it from its edge, the surface kind
|
|
110
|
+
and band width, and a road's lane width. Roads and lots get asphalt aggregate (within a few meters,
|
|
111
|
+
crisp pale chips and dark pits a few centimeters across), blotchy wear, polished wheel
|
|
112
|
+
tracks and an oil line in each lane, grit in the gutters, storm-drain grates, manhole covers and
|
|
113
|
+
the odd darker repaired section; asphalt and concrete both get hairline cracks; lots get oil
|
|
114
|
+
stains; sidewalks and footways get 1.5 m saw-cut slabs and curbs 3 m ones, each slab its own
|
|
115
|
+
tone, weathered with water stains and, close up, the odd spot of gum; plazas and pedestrian areas get a half-meter paver grid; markings wear through to the
|
|
116
|
+
asphalt. Detail fades to the plain swatch with distance, so it never shimmers, and each layer's
|
|
117
|
+
noise is evaluated only where it still shows: distant pavement skips the fine layers, and only
|
|
118
|
+
fragments within 2 m of a frayed edge evaluate the fray. `setMaterial(undefined)` restores the plain material. Your own geometry can opt in with
|
|
119
|
+
`TerrainSurfaceMeshBuilder.surfaceSince(start, TERRAIN_SURFACE_KIND.road, …)`, or a
|
|
120
|
+
`surface` (and `lanes`) on a `TerrainLineBand`.
|
|
121
|
+
|
|
122
|
+
Edges that meet bare ground fray into it rather than ending on a ruled line: the lawn side of a
|
|
123
|
+
sidewalk, both sides of a footpath, dirt road or track bed, a road's shoulder, and a narrow fringe
|
|
124
|
+
traced around each lot and plaza (skipped where a road, footway, other paved area or building meets
|
|
125
|
+
it). The material discards a ragged margin so the ground shows through, and inside it a patchy
|
|
126
|
+
brown soil margin about a third of a meter wide, where soil washes and is tracked onto the paving;
|
|
127
|
+
it fades out by twenty or thirty meters away, where it would draw a ruled outline round each lawn.
|
|
128
|
+
Cast paving keeps its formed edge; grass blades creep up to 3 cm over it, and on the lawn side of
|
|
129
|
+
a street sidewalk or parking lot tufts of lawn about 35 cm across grow up to 10 cm over it,
|
|
130
|
+
so from mid distance that edge wanders rather than ending on a ruled line. Footpaths and plazas,
|
|
131
|
+
which often abut other paving, keep only the blades. Where a driveway, footway or paved lot crosses
|
|
132
|
+
a sidewalk's lawn side, that stretch stays clean (the builder clears the fray flag on its vertices,
|
|
133
|
+
`TerrainSurfaceMeshBuilder.unfraySince`), so no ragged seam runs between two slabs. Loose surfaces
|
|
134
|
+
(dirt, gravel, shoulders) break up to 0.1 m deep, a gentle waviness with blade-scale tufts rather
|
|
135
|
+
than blob islands. With multisampling the ragged edge is antialiased through alpha to coverage. The
|
|
136
|
+
margin shrinks away as its noise falls below a pixel, leaving the band's own antialiased edge, and
|
|
137
|
+
it also closes up within the last few meters of the camera, where its cells would grow to dozens of
|
|
138
|
+
pixels and read as torn paper. A band opts in with `fray: 'outer' | 'inner' | 'both'` on its
|
|
139
|
+
`TerrainLineBand` (outer is the edge away from the line); bridge decks keep their edges whole.
|
|
140
|
+
|
|
141
|
+
Maps often stop a cul-de-sac street at the bulb's near edge, or simply stop it, and trace only
|
|
142
|
+
the sidewalk wrapping round the end. Where a street dead-ends and a mapped footway rings most of a
|
|
143
|
+
circle about its end (rays from candidate centers meet the footway's inner edge at similar
|
|
144
|
+
distances, all but the mouth the street enters by), that circle is paved as plain asphalt: a
|
|
145
|
+
turning circle, or for a tight wrap a rounded end. Footway pieces inside it are clipped away, and
|
|
146
|
+
footways that merely connect to the street's end do not count as the ring, so a circle never
|
|
147
|
+
spills past a footway onto a lawn (`SurfaceNetwork.findTurningCircles`).
|
|
148
|
+
|
|
149
|
+
Roads overlap wherever they meet: at a junction, at the corners of their sidewalks, across a narrow
|
|
150
|
+
median. Their paving never shares a plane there, or which road drew on top would change pixel by
|
|
151
|
+
pixel as the camera moved: the widest road keeps its nominal heights, and each road overlapping
|
|
152
|
+
another sits one or more 2 mm steps lower, asphalt, sidewalks, curbs and paint alike
|
|
153
|
+
(`SurfaceNetwork.stackRoads`). A mapped line that would lie on itself becomes separate roads: where
|
|
154
|
+
it doubles back more sharply than a band can miter, as two one-way carriageways joined where a
|
|
155
|
+
divided road narrows do, and at the vertex its own end returns to, as a cul-de-sac mapped up the
|
|
156
|
+
street and round a loop back to its middle does. A stall line two parking bays share is painted once.
|
|
157
|
+
|
|
158
|
+
Curbs are a step, not a stripe: a 15 cm vertical face drops from the curb's road-side edge to the
|
|
159
|
+
asphalt, split finer than the ground grid so it follows the draped ground, and jointed like the curb top.
|
|
160
|
+
Any draped band can have one with `riser` (meters) on its `TerrainLineBand`.
|
|
161
|
+
|
|
162
|
+
Styles with streetlights also furnish their blocks: utility poles every 38 m on one side of each
|
|
163
|
+
street with sidewalks, set back behind the sidewalk with a crossarm and a pair of sagging lines
|
|
164
|
+
between neighbors, and a hydrant at the other curb about every 100 m. Residential streets that
|
|
165
|
+
run through residential land also get a mailbox on a post behind the sidewalk every 22–30 m on
|
|
166
|
+
both sides (on a mounting board, a top vaulted in stepped courses, a door with a handle facing the
|
|
167
|
+
curb and a red flag), about a third of them with a pair of wheeled bins beside it. Poles and
|
|
168
|
+
hydrants (1,200 boxes) and mailboxes and bins (4,800) have
|
|
169
|
+
per-tile budgets of their own, enough to furnish every street of a dense suburban tile.
|
|
170
|
+
Placement is fixed per road, skips junctions, buildings and other roads, and draws in the same
|
|
171
|
+
instanced box batch as the lights (`streetFurniture` in the surface stats).
|
|
172
|
+
|
|
85
173
|
`TERRAIN_SURFACE_STYLES` provides immutable presets. Pass a custom `TerrainSurfaceStyle` to
|
|
86
174
|
change colors, inferred road widths, sidewalk width, and defaults for each detail class:
|
|
87
175
|
|
|
@@ -102,16 +190,32 @@ await surfaces.setOptions({
|
|
|
102
190
|
|
|
103
191
|
- Modern streets use asphalt, exposed shoulder strips, curb/sidewalk bands, lane dividers, edge paint, stop
|
|
104
192
|
bars and zebra crossings. Shoulders, like the other street details, are drawn on the finest
|
|
105
|
-
detail tiles only: a few decimeters wide,
|
|
193
|
+
detail tiles only: local shoulders are a few decimeters wide, below a pixel on the coarser tiles kilometers
|
|
106
194
|
away, where draping them segment by segment once cost more memory than the roads themselves. Mapped paths are cut at same-grade carriageway edges, so footway
|
|
107
195
|
fills cannot compete with asphalt at walking height; paths beneath bridges remain continuous.
|
|
108
196
|
Nearby nodes on divided roads form one junction; crossings follow
|
|
109
197
|
the external approaches, and short turning links receive no independent crossings. Same-grade
|
|
110
198
|
junctions leave their centers clear of lane paint.
|
|
111
|
-
|
|
199
|
+
Mapped signal junctions and inferred crossings of two substantial arterials can receive curbside masts with bars over the incoming lanes,
|
|
112
200
|
yellow backplates, shaded round lenses, and one signal head per lane (up to three).
|
|
113
201
|
Red, amber and green lenses are self-lit, remaining visible at night. Instanced streetlights
|
|
114
202
|
occupy eligible corners outside road corridors, buildings, and water.
|
|
203
|
+
- Freeways receive wider paved shoulders, longer lane dashes, a yellow left edge on one-way
|
|
204
|
+
carriageways, and white ramp edges. Green overhead boards use mapped route references or
|
|
205
|
+
destinations. At a connected outgoing ramp, an advance gantry and roadside exit board use
|
|
206
|
+
its exit number and destination when supplied; otherwise the board says only `EXIT`.
|
|
207
|
+
Speed-limit boards require a literal numeric `maxspeed` and display its units. No exit numbers,
|
|
208
|
+
destinations, or numeric speed limits are invented. Supports sit outside the carriageway;
|
|
209
|
+
overhead panels retain at least six meters of inferred road clearance.
|
|
210
|
+
- Local intersections use octagonal stop signs by default. A local street meeting an arterial
|
|
211
|
+
receives stops only on the side street; an all-local junction receives all-way plaques.
|
|
212
|
+
Mapped `traffic_signals`, approach `stop`/`give_way` points and central `stop=all` controls
|
|
213
|
+
override this inference, with grade-separated points excluded. A broad `major_road` class
|
|
214
|
+
alone no longer puts lights at every residential intersection. Stop bars cover incoming lanes.
|
|
215
|
+
This is a North American visual fallback, not a survey of local regulations; disable
|
|
216
|
+
`details.inferStopSigns` to retain only mapped stops, or `details.roadSigns` to hide all signs.
|
|
217
|
+
Historical and minimal styles omit signs. Sign faces and lettering are batched geometry with
|
|
218
|
+
host-supplied fonts and no per-sign textures; the worker produces the same geometry as the direct renderer.
|
|
115
219
|
- Parking, plazas, and pedestrian polygons are filled, with holes retained. Pedestrian polygons
|
|
116
220
|
and mapped paths use distinct heights above parking pavement, including inferred lots, so
|
|
117
221
|
overlapping sidewalk and asphalt fills remain stable at walking height. Land cover, paved
|
|
@@ -162,6 +266,41 @@ call `surfaces.updateSignals(elapsedSeconds, resolver?)`; a resolver receives a
|
|
|
162
266
|
`updateTerrainSurfaceSignals(object, elapsedSeconds, resolver?)` on the surface object instead.
|
|
163
267
|
Here `object` is the group returned by `createTerrainSurfaceObject`.
|
|
164
268
|
|
|
269
|
+
`surfaces.updateDetail(position)` hides each tile's small detail beyond its draw distance from the
|
|
270
|
+
camera (the scene camera's world position), measured to the tile's footprint: road signs, street
|
|
271
|
+
fixtures and signal lenses beyond 900 m, lane markings and parked cars beyond 1.5 km. There they
|
|
272
|
+
span a pixel or less, yet from a jet a view held a few hundred such draws for tiles kilometers
|
|
273
|
+
away. Each mesh carries its distance as `userData.detailDistance`; the call does nothing until the
|
|
274
|
+
camera has moved 25 m or tiles have changed, and detail shows again as the camera nears.
|
|
275
|
+
|
|
276
|
+
## Signage data in PMTiles
|
|
277
|
+
|
|
278
|
+
PMTiles is the archive format, so its contents depend on the tile producer. OSM supports
|
|
279
|
+
[`highway=motorway_junction` with `ref`](https://wiki.openstreetmap.org/wiki/Tag:highway%3Dmotorway_junction)
|
|
280
|
+
for an exit number; ramps can carry `junction:ref`, `destination` and `destination:ref`.
|
|
281
|
+
Road `ref` identifies the route, not the exit. The decoder preserves these fields as `ref`,
|
|
282
|
+
`junctionRef`, `destination` and `destinationRef`, plus `maxspeed`; exit POIs retain `ref` and
|
|
283
|
+
legacy `exit_to` as `exitTo`. `oneway=-1` reverses the decoded geometry, and one-way fragments
|
|
284
|
+
join without reversing their travel direction. Motorways are implicitly one-way unless the
|
|
285
|
+
source explicitly says otherwise.
|
|
286
|
+
|
|
287
|
+
OSM also records [`highway=stop` and `stop=all`](https://wiki.openstreetmap.org/wiki/Tag:highway%3Dstop),
|
|
288
|
+
`highway=traffic_signals`, and `highway=give_way`. These need point features in the configured
|
|
289
|
+
POI layer; merely having an OSM-derived basemap does not guarantee their presence.
|
|
290
|
+
The [Protomaps layer reference](https://docs.protomaps.com/basemaps/layers) describes a selective
|
|
291
|
+
context map. Its current road producer retains route/shield text and high-zoom one-way cues,
|
|
292
|
+
but does not emit the destination, junction-reference or maxspeed attributes consumed here.
|
|
293
|
+
Accurate numbered exits and posted limits therefore require an enriched tile source that retains
|
|
294
|
+
those tags. There are no live Overpass requests or extra network lookups during rendering.
|
|
295
|
+
|
|
296
|
+
Numeric OSM speeds without a unit are km/h; explicit `mph` stays mph. Variable, conditional and
|
|
297
|
+
country-code speed values are not interpreted. Road signs, gantry positions and sparse spacing
|
|
298
|
+
are visual approximations, using a right-hand-traffic layout, with a maximum of 48 signs per
|
|
299
|
+
detail tile inside its shared fixture budget. Labels fit uniformly within the panel (bounded to 80 characters); unsupported
|
|
300
|
+
glyphs use a question mark. `stats().roadSigns` counts the placed boards. Ambient traffic uses
|
|
301
|
+
the more conservative signal inference and treats mapped stop controls as give-way controls;
|
|
302
|
+
this change does not add a full-stop/dwell simulation for the decorative signs.
|
|
303
|
+
|
|
165
304
|
Ground surfaces render at all available semantic levels. Fine markings and fixtures default to
|
|
166
305
|
the finest pyramid level; `detailLevelsBelowMax` extends them to coarser levels. Fixture/car and
|
|
167
306
|
detail-work budgets bound each tile. A portion of the detail budget is reserved for parking.
|
|
@@ -253,3 +392,138 @@ world units along the path; callers can carry phase across tile fragments when t
|
|
|
253
392
|
provides route chainage. `terrainLinePath` and `sampleTerrainLine` are exported for custom
|
|
254
393
|
attachment/model placement. Railway switches, wire sag and route-level cross-tile topology are
|
|
255
394
|
separate consumers of this foundation, and traffic simulation is [ambient life](ambient-life.md).
|
|
395
|
+
|
|
396
|
+
## Road sign fonts
|
|
397
|
+
|
|
398
|
+
Pass `fonts` and optional `signFont` in surface options. The default Earth font catalog supplies
|
|
399
|
+
Overpass for highway, exit, speed and stop signs; source case and accents are preserved. Font
|
|
400
|
+
geometry is batched into the sign mesh and the worker receives font data only when it changes.
|
|
401
|
+
See [Fonts and lettering](typography.md) for the shared layout engine and custom typefaces.
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
## Road sign pattern library
|
|
405
|
+
|
|
406
|
+
The world-explorer sample includes **Road sign library** (`road-signs.html`), linked from its
|
|
407
|
+
main view. It renders ten patterns from synthetic semantic tiles through the production
|
|
408
|
+
detector, with country/state selectors, a 50-state route-marker collection, searchable cards,
|
|
409
|
+
rotatable 3D previews, and source-cue annotations. The samples
|
|
410
|
+
are demonstrations, not records of surveyed signs. All hardware positions are estimated.
|
|
411
|
+
|
|
412
|
+
| Pattern ID | Supported cues | Missing-data behavior |
|
|
413
|
+
| --- | --- | --- |
|
|
414
|
+
| `highway-overhead` | Connected motorway departure; `destination`, `destination:ref`, `junction:ref`, or nearby `motorway_junction` metadata | Regional exit label, if configured, only when topology establishes a departure |
|
|
415
|
+
| `highway-exit` | Same departure cues; smaller roadside assembly | No invented exit numbers |
|
|
416
|
+
| `all-way-stop` | Central `stop=all` or mapped controls on every incoming approach | Local junctions may infer all-way stops; explicit signals override them |
|
|
417
|
+
| `minor-stop` | Mapped approach stop | Minor approaches to an arterial may infer stops |
|
|
418
|
+
| `street-speed` | Literal `maxspeed` | Omit unknown, conditional, or variable limits |
|
|
419
|
+
| `freeway-speed` | Motorway plus literal `maxspeed` | Same rule, with a 40% larger panel outside the shoulder |
|
|
420
|
+
| `yield` | Mapped `highway=give_way` approach | No inference from ramps or roundabouts alone |
|
|
421
|
+
| `attraction` | Ramp `destination` with aligned `destination:colour=brown` | Nearby tourism POIs alone do not establish an exit or driving distance |
|
|
422
|
+
| `route-guide` | Motorway `ref`/`shield_text`, name, or destination | Omit when labels are unknown |
|
|
423
|
+
| `route-marker` | Exact supported `network` plus `shield_text`/`ref`; explicit state reference; local `SR`/`SH` plus state geography | Omit ambiguous or unsupported networks; never invent a route number |
|
|
424
|
+
|
|
425
|
+
The MVT decoder retains `destination:colour` as `destinationColour`. Semicolon entries align
|
|
426
|
+
with the destination list, including empty entries. A single brown colour applies to the
|
|
427
|
+
whole destination list. Mixed green/brown destinations become separate boards, keeping only
|
|
428
|
+
the brown names on the attraction board. Exit numbers are included only when mapped.
|
|
429
|
+
See [OSM destination colours](https://wiki.openstreetmap.org/wiki/Key:destination:colour) and
|
|
430
|
+
[FHWA recreational sign guidance](https://mutcd.fhwa.dot.gov/pdfs/11th_Edition/mutcd11thedition.pdf).
|
|
431
|
+
Global pattern identities are independent of the regional appearance described below.
|
|
432
|
+
Directional/lane-specific destination suffixes, service logos,
|
|
433
|
+
temporary restrictions, and exact hardware surveys are not supported yet.
|
|
434
|
+
|
|
435
|
+
`TERRAIN_ROAD_SIGN_PATTERNS` from `@bendyline/molen-terrain/client` exposes the catalog.
|
|
436
|
+
Each `SurfaceSign` in `object.userData.roadSigns` carries `pattern`, `evidence`, `source`,
|
|
437
|
+
the resolved `appearance`, and an optional `roadId`. For an overhead exit or attraction board, that ID identifies the ramp
|
|
438
|
+
providing the legend. `source: 'mapped'` means the control or legend comes from mapped data;
|
|
439
|
+
it does not mean the gantry, pole, or exact sign location was surveyed. This metadata also
|
|
440
|
+
survives the surface-worker path. `createTerrainRoadSignObject(sign, context, { fonts })` renders
|
|
441
|
+
one detected sign with the same batched face/support geometry; dispose it with
|
|
442
|
+
`disposeTerrainSurfaceObject`. Coordinates remain local to the supplied tile context.
|
|
443
|
+
|
|
444
|
+
## Regional sign appearances
|
|
445
|
+
|
|
446
|
+
Patterns describe what a sign means and which map cues support it. A `TerrainRoadSignProfile`
|
|
447
|
+
supplies guide colours, speed-sign shape, native units, exit wording, stop/yield legends,
|
|
448
|
+
roadside placement and a font role. The first Earth presets are:
|
|
449
|
+
|
|
450
|
+
| Country | Motorway guides | Posted speed panel | Roadside placement |
|
|
451
|
+
| --- | --- | --- | --- |
|
|
452
|
+
| United States | Green | Rectangular, mph | Right |
|
|
453
|
+
| Great Britain | Blue | Circular, mph | Left |
|
|
454
|
+
| Germany | Blue | Circular, km/h | Right |
|
|
455
|
+
| France | Blue | Circular, km/h | Right |
|
|
456
|
+
| Italy | Green | Circular, km/h | Right |
|
|
457
|
+
| Switzerland | Green | Circular, km/h | Right |
|
|
458
|
+
|
|
459
|
+
Europe has no single guide colour. Destination category also matters: British primary routes
|
|
460
|
+
use green and local destinations white; French major destinations use green and other
|
|
461
|
+
destinations white; Italian non-motorway interurban routes use blue. The British and French
|
|
462
|
+
side-exit presets use white when the destination category is unknown. A uniform mapped
|
|
463
|
+
`destination:colour` of green, blue, white or yellow overrides the default panel colour;
|
|
464
|
+
light panels receive dark lettering. Mixed-colour panels remain approximate. The catalog's
|
|
465
|
+
`sources` link the relevant national references, and its `notes` state each preset's limits.
|
|
466
|
+
|
|
467
|
+
The Earth pack provides `road-signs` (`signs/catalog.json`) and `road-sign-regions`
|
|
468
|
+
(`signs/regions.atlas.json`). `loadEarthContent` loads these independently of buildings and
|
|
469
|
+
fonts. World explorer and `mountEarthView` select a profile from the terrain tile's centre,
|
|
470
|
+
using dedicated country and U.S. state outlines in the same Mercator coordinate frame.
|
|
471
|
+
Exact containment wins; a bounded 2.5 km nearest-outline fallback fills coastal gaps.
|
|
472
|
+
Right-driving countries are included too, so their interiors cannot inherit a nearby left-driving rule.
|
|
473
|
+
Architectural regions do not select signs. These simplified outlines can be imprecise near borders and
|
|
474
|
+
coasts. Countries without a preset use the neutral `generic` profile; it is not a national
|
|
475
|
+
standard and keeps source units visible. Country coverage is deliberately explicit.
|
|
476
|
+
|
|
477
|
+
Posted values are never converted or guessed from the profile: `50` means 50 km/h, while
|
|
478
|
+
`50 mph` remains 50 mph even under a metric preset. Circular signs omit the unit only when
|
|
479
|
+
it matches the country's convention. All presets except the U.S. require mapped stop controls
|
|
480
|
+
by default; a local crossroad alone does not establish an all-way stop. Explicit mapped
|
|
481
|
+
signals still win. `details.inferStopSigns` can override the profile's inference default.
|
|
482
|
+
The same regional driving side controls roadside signs, approach stop lines, signal heads and
|
|
483
|
+
the inner edge of a one-way motorway. Mapped one-way direction is preserved. Marking colours
|
|
484
|
+
and sign hardware remain medium-fi approximations rather than complete national standards.
|
|
485
|
+
|
|
486
|
+
Earth uses these country outlines for ambient traffic too. Japan, Australia, New Zealand,
|
|
487
|
+
Ireland, India, Thailand, South Africa and other left-driving countries and territories use
|
|
488
|
+
the `generic-left` profile where a national sign appearance is not supplied. It retains neutral
|
|
489
|
+
panels and explicit source units while placing signs on the left. Hong Kong and Macao have
|
|
490
|
+
separate outlines from mainland China. Selection uses the same terrain tile centre for roads
|
|
491
|
+
and traffic; simplified borders and coastal outlines can be imprecise.
|
|
492
|
+
|
|
493
|
+
Custom hosts can pass `signProfile` in `TerrainSurfaceOptions`. It takes precedence over the
|
|
494
|
+
optional fourth argument to `createTerrainSurfaceRenderer`, a `(x, z) => profile` resolver.
|
|
495
|
+
The host resolves the profile before dispatching a serializable worker job. To share Earth's
|
|
496
|
+
selection, call `createEarthRoadSigns(content.roadSigns, metersPerUnit)` from
|
|
497
|
+
`@bendyline/molen-earth/client` and pass its `profileAt` callback. Without sign content or an
|
|
498
|
+
explicit profile, standalone terrain rendering keeps its existing U.S. appearance.
|
|
499
|
+
|
|
500
|
+
`TerrainSurfaceOptions.drivingSide` overrides handedness for markings, signals and signs together.
|
|
501
|
+
`mountEarthView({ ambient: { drivingSide: 'left' } })` applies this override to its surfaces as
|
|
502
|
+
well as its traffic. Without an override, the Earth sign content selects the rule automatically;
|
|
503
|
+
without that content, the default remains right. Custom hosts can share
|
|
504
|
+
`createEarthRoadSigns(...).drivingSideAt` with `EarthAmbient`.
|
|
505
|
+
|
|
506
|
+
Profiles request roles such as `sign.gb` or `sign.de`; hosts can bind those roles to additional
|
|
507
|
+
compiled font faces. The shipped catalog currently falls back to Overpass for every country.
|
|
508
|
+
|
|
509
|
+
The Earth pack also provides `road-sign-profiles` (`signs/us-states.json`) and `route-shields`
|
|
510
|
+
(`signs/route-shields.json`). All 50 U.S. states have primary route-marker artwork and subdivision
|
|
511
|
+
profiles, which override the country appearance. U.S. regulatory panels stay shared;
|
|
512
|
+
municipal street-name blade styles are not inferred from state identity. View all state markers
|
|
513
|
+
at `road-signs.html?view=states`, or use `?region=us-wa` for Washington's full pattern set.
|
|
514
|
+
|
|
515
|
+
The decoder retains `network` and `shield_text` independently as `network` and `shieldText`.
|
|
516
|
+
Exact network identity takes precedence over geography. County, Interstate, U.S. highway,
|
|
517
|
+
business, toll and unsupported secondary networks are not mapped to primary state shields.
|
|
518
|
+
Tennessee specifically requires `US:TN:primary`. Missing/compound route numbers are omitted.
|
|
519
|
+
For custom hosts, pass `routeShields: content.roadSigns.shields` with the profile resolver.
|
|
520
|
+
The worker caches this vector library just like fonts; sign annotations retain network and
|
|
521
|
+
number without copying the artwork into every detection record. `profileForSubdivision`
|
|
522
|
+
provides explicit subdivision lookup alongside `profileForCountry`.
|
|
523
|
+
|
|
524
|
+
Artwork is a medium-fi adaptation of CC0 OpenStreetMap Americana symbols and authored shapes;
|
|
525
|
+
state borders use public-domain Natural Earth data. It is not a set of exact DOT fabrication
|
|
526
|
+
drawings. See `content/earth/signs/README.md` for licenses, source pins and offline regeneration.
|
|
527
|
+
It approximates Highway Gothic and does not supply exact Transport, DIN or Frutiger faces.
|
|
528
|
+
Route shields, detailed national panel layouts, lane arrows and multilingual exit plaques
|
|
529
|
+
remain future extensions. Source destination names are preserved rather than translated.
|
|
@@ -340,6 +340,21 @@ function frame(position: [number, number, number]) {
|
|
|
340
340
|
}
|
|
341
341
|
```
|
|
342
342
|
|
|
343
|
+
For movement and ground placement, use `earth.stream.sampleSurfaceHeight(x, z)`: it samples the
|
|
344
|
+
displayed mesh's triangles at their current detail level, including refinement transitions.
|
|
345
|
+
`sampleHeight(x, z)` retains the full-resolution source elevation, which can differ from the
|
|
346
|
+
visible mesh between vertices. Both return `undefined` outside displayed terrain. Roads, land
|
|
347
|
+
cover, bridges and model-owned openings still require collision against their visible geometry;
|
|
348
|
+
the Earth view combines rendered terrain heights with those collision queries for walking and driving.
|
|
349
|
+
|
|
350
|
+
For moving cameras, `stream.update(view, futureViews)` accepts optional predicted views, nearest
|
|
351
|
+
in time first. It prepares a bounded set of future leaves, semantic layers and GPU resources in
|
|
352
|
+
the hidden resident cache without changing the current selection. Omit the second argument to
|
|
353
|
+
stop prediction. Both the Earth view and World Explorer use `createEarthTilePreloader` from
|
|
354
|
+
`@bendyline/molen-earth/client` to predict 4, 8 and 12 seconds of fast travel, capped at 4 km.
|
|
355
|
+
Its `views(nowMs, view, steady)` takes positions already in the Earth adapter's metric world frame;
|
|
356
|
+
pass `steady: false` during scripted camera animations and call `reset()` when changing frames.
|
|
357
|
+
|
|
343
358
|
The selector measures projected source-sample spacing, adapts its error/range to the selected-tile
|
|
344
359
|
budget, requests ancestors before descendants, and retains a displayed parent until all selected
|
|
345
360
|
descendant coverage is resident. A selected tile that is not resident yet shows through its
|
|
@@ -368,6 +383,11 @@ water and road surfaces are marked) and water with `userData.shadowReceiver = fa
|
|
|
368
383
|
adaptive tiles. Its optional inclusive `minLevel`/`maxLevel` bounds keep expensive decoration off
|
|
369
384
|
coarse fallback and horizon tiles. Layer objects become visible only with their selected surface,
|
|
370
385
|
remain cached briefly across LOD transitions, and are disposed with their resident height tile.
|
|
386
|
+
A layer object that drapes its whole tile with opaque ground (landcover over a full-tile
|
|
387
|
+
background, as the regional worldgen classification layer builds) can set
|
|
388
|
+
`userData[TERRAIN_COVERS_GROUND] = true`. While it is displayed, the stream stops drawing that
|
|
389
|
+
tile's bare surface, which it would hide anyway: the surface keeps `visible` for the stream's own
|
|
390
|
+
bookkeeping but leaves every render layer, so no camera or shadow pass draws it.
|
|
371
391
|
|
|
372
392
|
Optional package sidecars cross a normalized boundary before reaching those layers. Call
|
|
373
393
|
`openTerrainPackageSemantics(packageDoc, { decoder, baseUrl })` to open and header-check declared
|
|
@@ -393,6 +413,29 @@ advance its highlights without discontinuities across floating-origin shifts. Op
|
|
|
393
413
|
avoids dark overlap seams while adjacent or parent/child water tiles refine. Expensive semantics
|
|
394
414
|
can be level-bounded, toggled without re-decoding resident objects, and disposed with the elevation
|
|
395
415
|
tile. Applications may replace the decoder, renderer, materials, or model geometry independently.
|
|
416
|
+
When the layer context carries an `admission` queue, the default renderer builds each tile with
|
|
417
|
+
`createTerrainSemanticObjectSliced`: the same group as `createTerrainSemanticObject`, built a couple
|
|
418
|
+
of milliseconds per admitted job (pausing between water polygons and building footprints), so a
|
|
419
|
+
harbor's water or a coarse tile's thousands of footprints no longer hold one frame.
|
|
420
|
+
|
|
421
|
+
Package semantic sources keep the last few decoded tiles, and older ones while a layer still holds
|
|
422
|
+
them, so the layers that each load a tile (classification, surfaces, water, tunnels, building
|
|
423
|
+
detail) share one decode. Tiles cross to workers as packets (`terrainSemanticTilePacket`); a tile
|
|
424
|
+
derived by replacing its buildings or transportation can carry its base's packet and the edit
|
|
425
|
+
(`deriveTerrainSemanticTilePacket`) instead of being cloned whole. A renderer that keeps tiles to
|
|
426
|
+
rebuild them later keeps `keepTerrainSemanticTile(tile)` rather than the tile: calling it answers
|
|
427
|
+
the tile while it lives, else decodes it again from its packet, so the decoded points need not
|
|
428
|
+
stay on the heap meanwhile.
|
|
429
|
+
|
|
430
|
+
Mapped lake polygons also clear coarse elevation and landcover beneath their water surface,
|
|
431
|
+
preserving polygon holes as islands. Small bank faces close the difference between the rendered
|
|
432
|
+
ground triangles and the water level; clipped tile edges do not become artificial banks. These
|
|
433
|
+
openings follow hydrology tile residency, independently of landmark loading, and restore the
|
|
434
|
+
original ground on hide/unload. Roads and bridge surfaces retain their geometry. Source height
|
|
435
|
+
samples remain available for anchoring and physics. Ground clipping keeps shared grid vertices
|
|
436
|
+
indexed instead of duplicating every triangle's attributes.
|
|
437
|
+
`shorelineGroundOffset` defaults to the landcover lift of 0.18m, including when hydrology and
|
|
438
|
+
classification render in separate layers; set it to `0` for a bare elevation surface.
|
|
396
439
|
|
|
397
440
|
For the standard path, `createTerrainPackageSemanticLayers` opens every optional sidecar and returns
|
|
398
441
|
classification, hydrology, and human-feature layers ready for
|