@bendyline/molen-tooling 0.0.13 → 0.0.15

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.
Files changed (38) hide show
  1. package/dist/capture/harness.js +551 -335
  2. package/dist/capture/worldgen-preview.js +539 -325
  3. package/dist/docs-src/guide/adaptive-performance.md +23 -17
  4. package/dist/docs-src/guide/aircraft.md +66 -18
  5. package/dist/docs-src/guide/ambient-life.md +15 -2
  6. package/dist/docs-src/guide/audio.md +38 -1
  7. package/dist/docs-src/guide/browser-mount.md +11 -0
  8. package/dist/docs-src/guide/determinism.md +2 -1
  9. package/dist/docs-src/guide/dioramas.md +7 -0
  10. package/dist/docs-src/guide/earth-view.md +45 -8
  11. package/dist/docs-src/guide/glass.md +134 -0
  12. package/dist/docs-src/guide/graphics-performance.md +42 -13
  13. package/dist/docs-src/guide/navigation.md +23 -5
  14. package/dist/docs-src/guide/night-lighting.md +2 -1
  15. package/dist/docs-src/guide/regional-fleets.md +9 -4
  16. package/dist/docs-src/guide/regional-world.md +6 -2
  17. package/dist/docs-src/guide/sky.md +2 -2
  18. package/dist/docs-src/guide/surface-rendering.md +9 -3
  19. package/dist/docs-src/guide/terrain.md +42 -9
  20. package/dist/docs-src/guide/vehicle-interiors.md +34 -3
  21. package/dist/docs-src/guide/vehicles.md +47 -1
  22. package/dist/docs-src/guide/weather.md +60 -21
  23. package/dist/docs-src/llms.txt +3 -2
  24. package/dist/docs-src/schemas/components.md +979 -140
  25. package/dist/templates/city-courier/gen/molen-types.ts +103 -2
  26. package/dist/templates/city-courier/scripts/molen-scripts.d.ts +102 -1
  27. package/dist/templates/city-courier/src/shared/playback.ts +21 -10
  28. package/dist/templates/cubes/src/shared/playback.ts +21 -10
  29. package/dist/templates/data-viz/src/shared/playback.ts +21 -10
  30. package/dist/templates/figures-gallery/src/shared/playback.ts +21 -10
  31. package/dist/templates/index.json +17 -17
  32. package/dist/templates/skybound/gen/molen-types.ts +103 -2
  33. package/dist/templates/skybound/scripts/molen-scripts.d.ts +102 -1
  34. package/dist/templates/skybound/src/shared/playback.ts +21 -10
  35. package/dist/templates/top-down-arena/scripts/molen-scripts.d.ts +102 -1
  36. package/dist/templates/top-down-arena/src/gen/molen-types.ts +103 -2
  37. package/dist/templates/top-down-arena/src/shared/playback.ts +21 -10
  38. package/package.json +12 -12
@@ -20,7 +20,7 @@ Add this entity to a `molen/scene@3` manifest:
20
20
  "referenceAltitude": 0,
21
21
  "gasConstant": 287.05
22
22
  },
23
- "clouds": { "coverage": 0.98, "density": 0.95, "baseAltitude": 1600, "thickness": 1200, "scale": 16000 },
23
+ "clouds": { "type": "stratus", "coverage": 0.98, "density": 0.95, "baseAltitude": 1600, "thickness": 1200, "scale": 16000 },
24
24
  "precipitation": { "kind": "rain", "intensity": 0.7 },
25
25
  "visibility": 4500,
26
26
  "seed": 1
@@ -37,8 +37,8 @@ Weather participates in state hashes, checkpoints and replays.
37
37
 
38
38
  `WeatherData`, `weatherSchema`, `resolveWeather`, `WeatherProfile` and `weatherProfile` are
39
39
  exported by `@bendyline/molen-schema`. The client re-exports the types, resolver and presets.
40
- `weatherProfile('sunny' | 'partly-cloudy' | 'overcast' | 'rain' | 'snow' | 'fog')` returns fresh
41
- editable data. `resolveWeather(data)` supplies defaults and copies nested values. Validate
40
+ `weatherProfile('sunny' | 'partly-cloudy' | 'overcast' | 'rain' | 'storm' | 'snow' | 'fog')`
41
+ returns fresh editable data. `resolveWeather(data)` supplies defaults and copies nested values. Validate
42
42
  external data with `weatherSchema.parse` before using it in typed code.
43
43
 
44
44
  | Parameter | Meaning |
@@ -51,8 +51,10 @@ external data with `weatherSchema.parse` before using it in typed code.
51
51
  | `atmosphere.windVelocity` | World XYZ velocity in m/s; +X east and -Z north in Earth worlds. A velocity toward a direction, not a meteorological "from" bearing. |
52
52
  | `atmosphere.referenceAltitude` | Absolute world Y where temperature/pressure apply, default 0 m. |
53
53
  | `atmosphere.gasConstant` | Specific gas constant, default 287.05 J/(kg·K) for dry air; configurable for other worlds. |
54
- | `clouds.coverage`, `density` | Independent 0–1 coverage and optical density controls. |
55
- | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y, layer separation, and horizontal pattern repeat size in meters. |
54
+ | `clouds.type` | `cumulus` (default): separate fair-weather heaps; `stratocumulus`: a lumpy, closed layer; `stratus`: a flat grey sheet; `cumulonimbus`: towering storm cells with anvil tops (give them a deep layer). |
55
+ | `clouds.coverage`, `density` | Independent 0–1 controls: the share of the sky the layer covers (1 closes it) and its optical density. |
56
+ | `clouds.baseAltitude`, `thickness`, `scale` | Absolute base Y and depth of the layer, and the horizontal pattern repeat size, in meters. |
57
+ | `clouds.cirrus`, `cirrusAltitude` | Coverage 0–1 of a thin, wispy high cirrus layer (default 0) and its absolute Y (default 9000 m). Independent of the main layer. |
56
58
  | `precipitation.kind`, `intensity` | Explicit none/rain/snow and 0–1 visual intensity; not calibrated mm/hour. |
57
59
  | `visibility` | Approximate visual fade distance in meters, independent of clouds and precipitation. |
58
60
  | `wind.referenceHeight` | Height above ground in meters where `windVelocity` applies; default 10. |
@@ -62,6 +64,8 @@ external data with `weatherSchema.parse` before using it in typed code.
62
64
  | `wind.terrain` | 0–1 strength of slope flow: lift up windward hillsides, sink and rougher air in the lee; default 0. |
63
65
 
64
66
  Presets are starting points, not classifications that constrain these independent parameters.
67
+ Partly cloudy is cumulus under some cirrus, overcast a closed stratocumulus deck, rain and snow
68
+ stratus, and storm scattered cumulonimbus 7 km deep with heavy rain.
65
69
  Every preset includes a `wind` block: light chop and gusts for sunny skies, rougher air in rain,
66
70
  and nearly still, strongly sheared air in fog.
67
71
 
@@ -139,30 +143,65 @@ viewer.renderer.setWeatherTimeOverride(undefined); // resume simulation time
139
143
  viewer.renderer.setWeather(undefined); // remove weather effects
140
144
  ```
141
145
 
142
- Clouds use two wind-advected procedural layers at absolute world altitudes. They occlude
143
- celestial bodies, tint through dusk/night, and reduce direct lighting. Rain and snow share a
144
- bounded camera-local particle batch with wind drift. Seed/time sampling is deterministic;
145
- floating-origin changes preserve world alignment. No simulation random numbers are consumed.
146
+ The cloud layer is a volume, ray-marched between `baseAltitude` and the top of the layer on
147
+ both backends: a weather map decides where clouds stand, a 3D billow noise carves them, and each
148
+ sample is lit by marching toward the sun (or moon), so cumulus have flat grey bases and bright,
149
+ rounded tops, a closed deck is lumpy underneath, and a low sun lights cloud bases from below.
150
+ You can fly over, under and into it; inside a cloud the view whites out. Cirrus are a flat sheet
151
+ of wind-combed streaks at `cirrusAltitude`. Clouds drift with the mean wind, cumulus slowly boil,
152
+ cirrus ride faster, and all of them occlude celestial bodies, tint through dusk and night, take
153
+ the scene's haze (less of it looking up, since haze lies near the ground) and reduce direct
154
+ lighting. Rain and snow share a bounded camera-local particle batch with wind drift. Seed/time
155
+ sampling is deterministic; floating-origin changes preserve world alignment. No simulation
156
+ random numbers are consumed.
157
+
158
+ `viewer.renderer.setCloudQuality('low' | 'medium' | 'high' | 'ultra')` (default `'medium'`) sets
159
+ the work per pixel: ray-march steps and light samples, edge erosion from `'high'`, and from
160
+ `'high'` cloud shadows. Cloud shadows project the cloud field along the sun onto every lit
161
+ surface, terrain, buildings and vehicles alike, and replace the even dimming of direct light that
162
+ cloud cover applies at lower qualities. The quality is uniform-driven, so changing it, even every
163
+ frame, rebuilds no shader. `mountEarthView` sets it from its performance tier: low at the two
164
+ lowest levels, medium up to Balanced, high and ultra above (with cloud shadows). Measured on a
165
+ 1280x720 partly cloudy view, clouds cost about 0.5-0.7 ms of GPU time at low and 1.0-1.7 ms at
166
+ medium to ultra on an integrated laptop GPU, and 0.15-0.65 ms on a discrete one; looking out
167
+ from inside a cloud costs about twice that.
168
+
169
+ The deck is one draw (a camera-centred plane where view rays enter the layer, or nested shells
170
+ around a camera inside it, so nearer geometry hides it through the ordinary depth test), cirrus
171
+ one more and precipitation one. The noise is generated once per page, a few milliseconds per
172
+ frame, and the clouds appear when it is ready (about a second); sunny startup generates no cloud
173
+ noise and allocates no particle batch. Animation follows simulation time independently of a
174
+ sky-time preview override, so pauses and captures remain repeatable.
175
+
176
+ On WebGL, cloud shadows reach a lit material through three's lighting chunks. A material that
177
+ installs its own `onBeforeCompile` keeps them by calling the prototype's first:
146
178
 
147
- Standard materials work on WebGL and WebGPU, with up to two cloud draws and one precipitation
148
- draw. Textures generate locally when needed; sunny startup generates no cloud noise and
149
- allocates no particle batch. Animation follows simulation time independently of a sky-time
150
- preview override, so pauses and captures remain repeatable.
179
+ ```ts
180
+ material.onBeforeCompile = (shader, renderer) => {
181
+ THREE.Material.prototype.onBeforeCompile.call(material, shader, renderer);
182
+ // ...the material's own changes
183
+ };
184
+ ```
185
+
186
+ On WebGPU every node material receives them through the directional lights.
151
187
 
152
188
  Weather visibility temporarily limits scene fog; a nearer authored terrain fog limit and its
153
- clear foreground are preserved when weather visibility reaches beyond that limit. Removing
154
- weather restores the authored fog and lighting. Clouds are layered
155
- surfaces, not ray-marched 3D volumes: flying through a layer does not simulate condensation.
156
- Precipitation is a local visual field, including above cloud layers, without roof/terrain
157
- collision, splash, accumulation or wet-material response.
189
+ clear foreground are preserved when weather visibility reaches beyond that limit. Under a closed
190
+ deck the fog turns grey. Removing weather restores the authored fog and lighting. Clouds are a
191
+ visual volume: flying through one does not simulate icing, turbulence or condensation (wind
192
+ turbulence is the `wind` block's). Precipitation is a local visual field, including above cloud
193
+ layers, without roof/terrain collision, splash, accumulation or wet-material response.
158
194
 
159
195
  ## World explorer
160
196
 
161
- The Weather dropdown includes Fair, Sunny / clear, Partly cloudy, Overcast, Rain, Snow and Fog.
197
+ The Weather dropdown includes Fair, Sunny / clear, Partly cloudy, Overcast, Rain, Thunderstorms,
198
+ Snow and Fog.
162
199
  The explorer opens on Fair, its own preset: Sunny with scattered fair-weather cumulus (30%
163
200
  coverage at 45% density, in 24 km cells rather than the default 16 km), so a street-level sky is
164
- not a bare gradient and the deck breaks into separate clouds instead of streaks at the horizon. Weather details mixes cloud coverage/density/altitude, precipitation, intensity, visibility,
165
- temperature, pressure and wind, marking the profile Custom. Temperature and pressure controls
201
+ not a bare gradient and the layer breaks into separate clouds toward the horizon. Weather
202
+ details mixes cloud type, coverage, density, base, depth and cirrus, precipitation, intensity,
203
+ visibility, temperature, pressure and wind, marking the profile Custom. Cloud quality follows the
204
+ graphics quality; High casts cloud shadows. Temperature and pressure controls
166
205
  refer to sea level, displayed in °C and hPa and stored in kelvin and pascals. The same component
167
206
  is installed in the explorer's vehicle/aircraft simulation.
168
207
 
@@ -4,7 +4,7 @@
4
4
  > three.js rendering client, authored through JSON schemas, a small typed API, and a headless
5
5
  > dev loop. This bundle is version-locked to the engine release.
6
6
 
7
- Engine version: 0.0.9. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
7
+ Engine version: 0.0.10. three.js peer range: >=0.184.0 <0.187.0 (developed against 0.184.0). Node ≥ 22.13, ESM only.
8
8
 
9
9
  ## Start here
10
10
 
@@ -38,7 +38,7 @@ downloads them into a project and pins them in project.json.
38
38
  - [WebGPU and WebGL](guide/rendering-backends.md): the `backend` option ('auto' | 'webgl' | 'webgpu') on the asynchronous client factories, legacy WebGL fallback, compatible materials, and world-explorer comparisons.
39
39
  - [Earth and authored skies](guide/sky.md): day/night cycles, geographic Sun/Moon positions and lunar phases, catalog stars, simulation clocks, custom-world palettes, and the sky observatory.
40
40
  - [Night lighting](guide/night-lighting.md): deterministic occupied windows, streetlamp emission and pavement pools, dusk activation, and light metadata for authored models.
41
- - [Weather and physical atmosphere](guide/weather.md): independent clouds, precipitation and visibility; profiles, temperature/pressure/wind for simulation and aircraft physics; cloud/rain/snow rendering.
41
+ - [Weather and physical atmosphere](guide/weather.md): independent clouds (cumulus, stratocumulus, stratus, cumulonimbus, cirrus), precipitation and visibility; profiles, temperature/pressure/wind for simulation and aircraft physics; volumetric cloud, cloud-shadow, rain and snow rendering and cloud quality.
42
42
  - [Sound and music](guide/audio.md): sound banks, `audioEnvironment`/`audioSource`/`audioZone` rules driven by weather, sky, listener and entity signals, `molen.audio.*` in scripts, `molen audio plan` to hear a scene headlessly, and the CC0 `molen.sounds` pack.
43
43
  - [Graphics performance](guide/graphics-performance.md): sparse transforms, static instancing, worker preparation, staged uploads, animation/light policy and terrain transitions.
44
44
  - [Terrain and world explorer](guide/terrain.md): fixed-grid and screen-space pyramid streaming,
@@ -60,6 +60,7 @@ downloads them into a project and pins them in project.json.
60
60
  - [Logical source bundles](guide/source-bundles.md): one copyable folder per entity, structure, vehicle, prop, or other authored thing, with all definitions and source files listed in `source.json`.
61
61
  - [Components](schemas/components.md): the component vocabulary `molen validate` checks against.
62
62
  - [Mountable vehicles](guide/vehicles.md): stable parking entities, driver seats, deterministic vehicle physics, safe exits, and cockpit/chase views.
63
+ - [Glass surfaces](guide/glass.md): physics-driven fracture, laminated windshield retention, tempered granules, independent frame failure, persistent state and render bindings.
63
64
  - [Boost mode](guide/boost-mode.md): optional 4× travel for people, vehicles and ambient life; Earth T toggle, host API and snapshot-safe kernel setting.
64
65
  - [Boats and water](guide/boats.md): powered hulls, helm controls, passengers, boarding points, swells, currents and Earth-view water coverage.
65
66
  - [Aircraft](guide/aircraft.md): P-51D and OH-6 assets, flight physics, cockpit instruments, practice airfield and controls.