@wildshard/shard-format 0.5.3 → 0.5.5

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 (19) hide show
  1. package/corpus/brasscap-mesa/blobs/bin/{086e3706070555baca863f6ecf9dbca09c084afa501d92d4246d896b09546f36.bin → 4a41356041e38f0a327a917a8a09454cf113c9136434adfae25a81df1d7ff95b.bin} +0 -0
  2. package/corpus/brasscap-mesa/blobs/bin/df8e7486d4d8d11b9b1ae751802292bb3f61b4520f30f9b5eba38764128c965e.bin +0 -0
  3. package/corpus/brasscap-mesa/blobs/glb/1dc5a40152ec7b6236e954db1b04ffea1dd75d57b2e178d83ac33b653a4466fb.glb +0 -0
  4. package/corpus/brasscap-mesa/blobs/glb/{ea428490cd5f2672676a2776a598b819b08246871e76de94b7196f9643144986.glb → 1e607ec4760a9caa60ac33fe7c64ab932c7bf69d323182cd42270580df7a8c6d.glb} +0 -0
  5. package/corpus/brasscap-mesa/blobs/glb/{c6d7cbdc4b2ee9d416edf4d736a4f374f08aea98ca395ad371a50a1853744cfc.glb → bcf68be2df950c4cb42915453df6e0fcb7b7acb4162ddc2c1ed2ad2cefa68ff7.glb} +0 -0
  6. package/corpus/brasscap-mesa/sections/look/look.json +1 -1
  7. package/corpus/brasscap-mesa/sections/sim/client-scripts.json +1 -1
  8. package/corpus/brasscap-mesa/sections/world/collision.json +1 -1
  9. package/corpus/brasscap-mesa/sections/world/props.json +1 -1
  10. package/corpus/brasscap-mesa/sections/world/tiles.json +1 -1
  11. package/corpus/brasscap-mesa/shard.json +1 -1
  12. package/corpus/brasscap-mesa/validation.json +1 -1
  13. package/package.json +5 -3
  14. package/src/format/look-sky.ts +165 -0
  15. package/src/format/materialFamilies.ts +25 -8
  16. package/src/format/scene-render.ts +160 -0
  17. package/src/format/shardSchema.ts +8 -3
  18. package/corpus/brasscap-mesa/blobs/bin/45cea35fab6bb06051a3286fca2307944850c7f9ed7aa89b7c24fafef28efda6.bin +0 -0
  19. package/corpus/brasscap-mesa/blobs/glb/3bc90e1dc9411d249697e4ec352baa4886f91cacfe4940ac43aed879f60966c9.glb +0 -0
@@ -0,0 +1,165 @@
1
+ /**
2
+ * `look.sky` (meta SHARD-SOURCE AP14): a painted sky, as a material graph the engine draws on its sky dome in place of
3
+ * the two-colour gradient. The engine filters the look's environment (`look.light.environment`) from the same dome, so
4
+ * a shiny surface or a pond reflects the painted sky, not the gradient. Absent, the dome keeps its keys' zenith and
5
+ * horizon and an older shard file keeps its bytes.
6
+ *
7
+ * The graph is an unlit material (`kind: 'material'`, `model: 'unlit'`) whose `surface.colour` is the sky's linear
8
+ * colour along the dome's direction: the dome is centred on the camera, so `normalize(positionLocal)` is the view ray
9
+ * (y up). It may read params (bound to a day key or public state like any graph), time and the sky light's direction,
10
+ * but no texture, and it draws no vertex stage, alpha, outline or lighting stage. It is costed under its own budget,
11
+ * {@link LOOK_SKY_BUDGET}: the dome covers at most the screen once, like one post pass. A sky is inline graph IR
12
+ * (`{ graph }`); the SDK writes it from TSL (`world.sky(...)`).
13
+ *
14
+ * Plain data and checks, no three.js.
15
+ */
16
+ import { pipe, rawTransform, strictObject, unknown } from 'valibot'
17
+
18
+ import { isJsonData } from './json.ts'
19
+ import { validateGraph } from './materialGraph.ts'
20
+
21
+ import type { GraphBudget, GraphIr } from './materialGraph.ts'
22
+ import type { GenericSchema } from 'valibot'
23
+
24
+ /** What validation names beside the graph: the day keys and public state fields its params may bind (any when absent). */
25
+ interface LookSkyBindings {
26
+ readonly dayKeys?: readonly string[]
27
+ readonly stateFields?: readonly string[]
28
+ }
29
+ /** The bindings a shard admits, as `graphBindingSources` reads them. */
30
+ interface LookSkySources {
31
+ readonly day: ReadonlyMap<string, unknown>
32
+ readonly state: readonly string[]
33
+ }
34
+ /** A checked sky: the graph, or every reason it is not one. */
35
+ type LookSkyCheck =
36
+ | { readonly ok: true; readonly graph: GraphIr }
37
+ | { readonly ok: false; readonly errors: readonly string[] }
38
+ /** Admitted data contracts. */
39
+ type LookSkyGraphInput = unknown
40
+ type LookSkyGraph = GraphIr
41
+ interface LookSkyInput {
42
+ graph: LookSkyGraphInput
43
+ }
44
+ interface LookSky {
45
+ graph: LookSkyGraph
46
+ }
47
+
48
+ /** A sky's ceilings: a painted dome with clouds is a few hundred nodes of value noise; no samplers */
49
+ const LOOK_SKY_BUDGET: GraphBudget = Object.freeze({
50
+ nodes: 640,
51
+ samplers: 0,
52
+ instructions: 1024,
53
+ })
54
+ const NONE = 0
55
+
56
+ /** A sky is an unlit dome material: no points, no other model. */
57
+ function modelErrors(graph: GraphIr): string[] {
58
+ const errors: string[] = []
59
+ if (graph.kind !== 'material' || graph.model !== 'unlit') {
60
+ errors.push('sky: an unlit material graph (kind material, model unlit)')
61
+ }
62
+ if (graph.primitive !== undefined && graph.primitive !== 'mesh') {
63
+ errors.push('sky: drawn on the dome mesh, not points')
64
+ }
65
+ return errors
66
+ }
67
+
68
+ /** A sky draws only its surface colour. */
69
+ function stageErrors(graph: GraphIr): string[] {
70
+ const errors: string[] = [],
71
+ stages = Object.keys(graph.stages).filter(
72
+ (stage: string): boolean => stage !== 'surface',
73
+ )
74
+ if (stages.length > NONE) {
75
+ errors.push(`sky: only the surface stage (not ${stages.join(', ')})`)
76
+ }
77
+ const surface = Object.keys(graph.stages.surface ?? {})
78
+ if (!surface.includes('colour')) {
79
+ errors.push('sky: surface.colour is the sky colour')
80
+ }
81
+ const extra = surface.filter((output: string): boolean => output !== 'colour')
82
+ if (extra.length > NONE) {
83
+ errors.push(`sky: surface.colour only (not ${extra.join(', ')})`)
84
+ }
85
+ return errors
86
+ }
87
+
88
+ /** The sky graph, or every reason `ir` is not one. */
89
+ function checkLookSky(
90
+ ir: unknown,
91
+ bindings: LookSkyBindings = {},
92
+ ): LookSkyCheck {
93
+ if (!isJsonData(ir)) {
94
+ return { ok: false, errors: ['sky: plain JSON data'] }
95
+ }
96
+ const checked = validateGraph(ir, { ...bindings, budget: LOOK_SKY_BUDGET })
97
+ if (!checked.ok) {
98
+ return {
99
+ ok: false,
100
+ errors: checked.errors.map((error: string): string => `sky: ${error}`),
101
+ }
102
+ }
103
+ const errors = [...modelErrors(checked.graph), ...stageErrors(checked.graph)]
104
+ return errors.length === NONE
105
+ ? { ok: true, graph: checked.graph }
106
+ : { ok: false, errors }
107
+ }
108
+
109
+ /** Every reason `ir` is not a sky (empty: it is one). */
110
+ function lookSkyErrors(
111
+ ir: unknown,
112
+ bindings: LookSkyBindings = {},
113
+ ): readonly string[] {
114
+ const checked = checkLookSky(ir, bindings)
115
+ return checked.ok ? [] : checked.errors
116
+ }
117
+
118
+ const SkyGraphSchema: GenericSchema<LookSkyGraphInput, LookSkyGraph> = pipe(
119
+ unknown(),
120
+ // oxlint-disable-next-line typescript/prefer-readonly-parameter-types -- valibot's transform context, which it owns
121
+ rawTransform(({ dataset, addIssue, NEVER }): GraphIr => {
122
+ const checked = checkLookSky(dataset.value)
123
+ if (!checked.ok) {
124
+ addIssue({ message: checked.errors.join('; ') })
125
+ return NEVER
126
+ }
127
+ return checked.graph
128
+ }),
129
+ )
130
+
131
+ /** `look.sky`: the dome's painted sky. */
132
+ const LookSkySchema: GenericSchema<LookSkyInput, LookSky> = strictObject({
133
+ graph: SkyGraphSchema,
134
+ })
135
+
136
+ /** The schema's rule for a sky (`look.sky?.graph`): its params bind only to the shard's day keys and public numeric state. */
137
+ function lookSkyRules(
138
+ graph: unknown,
139
+ sources: LookSkySources,
140
+ ): readonly string[] {
141
+ if (graph === undefined) {
142
+ return []
143
+ }
144
+ return lookSkyErrors(graph, {
145
+ dayKeys: [...sources.day.keys()],
146
+ stateFields: sources.state,
147
+ })
148
+ }
149
+
150
+ export {
151
+ LOOK_SKY_BUDGET,
152
+ LookSkySchema,
153
+ checkLookSky,
154
+ lookSkyErrors,
155
+ lookSkyRules,
156
+ }
157
+ export type {
158
+ LookSky,
159
+ LookSkyBindings,
160
+ LookSkyCheck,
161
+ LookSkyGraph,
162
+ LookSkyGraphInput,
163
+ LookSkyInput,
164
+ LookSkySources,
165
+ }
@@ -18,6 +18,8 @@
18
18
  import { detailLayer } from './detail-layer.ts';
19
19
  import type { DetailLayer } from './detail-layer.ts';
20
20
  import { pbrEmissive, pbrEmissiveIntensity } from './pbr-emissive.ts';
21
+ import { emissiveCard, emissiveMotion, surfaceBlend, surfaceDepthOffset, surfaceOpacity, surfaceSway, surfaceUvScroll } from './scene-render.ts';
22
+ import type { CardMotion, SurfaceSway } from './scene-render.ts';
21
23
  import * as v from 'valibot';
22
24
 
23
25
  const unit = v.pipe(v.number(), v.finite(), v.minValue(0), v.maxValue(1));
@@ -210,7 +212,7 @@ export function measureUv(role: MeasureRole, u: number, up: number, w: number, h
210
212
  }
211
213
 
212
214
  /** One PBR surface: metal / rough with colour, normal and packed ORM maps (occlusion r, roughness g, metalness b). */
213
- export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<PbrMaterialParamsInput['family'], PbrMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['colour'], undefined>, PbrMaterialParams['colour']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['colour'], undefined>>>; readonly roughness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['roughness'], undefined>, PbrMaterialParams['roughness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['roughness'], undefined>>>; readonly metalness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['metalness'], undefined>, PbrMaterialParams['metalness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['metalness'], undefined>>>; readonly maps: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['maps'], undefined>, PbrMaterialParams['maps']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['maps'], undefined>>>; readonly normalScale: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['normalScale'], undefined>, PbrMaterialParams['normalScale']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['normalScale'], undefined>>>; readonly occlusion: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['occlusion'], undefined>, PbrMaterialParams['occlusion']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['occlusion'], undefined>>>; readonly envStrength: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['envStrength'], undefined>, PbrMaterialParams['envStrength']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['envStrength'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>, PbrMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>>>; readonly faceted: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['faceted'], undefined>, PbrMaterialParams['faceted']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['faceted'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>, PbrMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>>>; readonly alphaCutoff: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>, PbrMaterialParams['alphaCutoff']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>>>; readonly ground: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['ground'], undefined>, PbrMaterialParams['ground']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['ground'], undefined>>>; readonly measure: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['measure'], undefined>, PbrMaterialParams['measure']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['measure'], undefined>>>; readonly detail: typeof detailLayer; readonly emissive: typeof pbrEmissive; readonly emissiveIntensity: typeof pbrEmissiveIntensity; }, undefined> = v.strictObject({
215
+ export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<PbrMaterialParamsInput['family'], PbrMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['colour'], undefined>, PbrMaterialParams['colour']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['colour'], undefined>>>; readonly roughness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['roughness'], undefined>, PbrMaterialParams['roughness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['roughness'], undefined>>>; readonly metalness: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['metalness'], undefined>, PbrMaterialParams['metalness']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['metalness'], undefined>>>; readonly maps: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['maps'], undefined>, PbrMaterialParams['maps']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['maps'], undefined>>>; readonly normalScale: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['normalScale'], undefined>, PbrMaterialParams['normalScale']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['normalScale'], undefined>>>; readonly occlusion: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['occlusion'], undefined>, PbrMaterialParams['occlusion']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['occlusion'], undefined>>>; readonly envStrength: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['envStrength'], undefined>, PbrMaterialParams['envStrength']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['envStrength'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>, PbrMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['vertexColours'], undefined>>>; readonly faceted: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['faceted'], undefined>, PbrMaterialParams['faceted']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['faceted'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>, PbrMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['doubleSided'], undefined>>>; readonly alphaCutoff: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>, PbrMaterialParams['alphaCutoff']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['alphaCutoff'], undefined>>>; readonly ground: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['ground'], undefined>, PbrMaterialParams['ground']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['ground'], undefined>>>; readonly measure: v.OptionalSchema<v.GenericSchema<Exclude<PbrMaterialParamsInput['measure'], undefined>, PbrMaterialParams['measure']>, MaterialSchemaDefault<Exclude<PbrMaterialParamsInput['measure'], undefined>>>; readonly detail: typeof detailLayer; readonly emissive: typeof pbrEmissive; readonly emissiveIntensity: typeof pbrEmissiveIntensity; readonly blend: typeof surfaceBlend; readonly opacity: typeof surfaceOpacity; readonly depthOffset: typeof surfaceDepthOffset; readonly sway: typeof surfaceSway; readonly uvScroll: typeof surfaceUvScroll; }, undefined> = v.strictObject({
214
216
  family: v.literal('pbr'),
215
217
  /** sRGB, multiplies the colour map */
216
218
  colour: v.optional(srgb, [1, 1, 1]),
@@ -240,6 +242,16 @@ export const PbrMaterialSchema: v.StrictObjectSchema<{ readonly family: v.Generi
240
242
  emissive: pbrEmissive,
241
243
  /** M4.3: the glow's linear gain (HDR); absent = 1 */
242
244
  emissiveIntensity: pbrEmissiveIntensity,
245
+ /** AP10: 'alpha' draws it see-through after the opaque world (a stencil, a decal); absent = opaque */
246
+ blend: surfaceBlend,
247
+ /** AP10: the alpha blend's scale; absent = 1 */
248
+ opacity: surfaceOpacity,
249
+ /** AP10: polygon offset (negative pulls toward the camera: a decal on a wall); absent = none */
250
+ depthOffset: surfaceDepthOffset,
251
+ /** AP12: wind sway, amplitude per vertex in the `_SWAY` channel; absent = rigid */
252
+ sway: surfaceSway,
253
+ /** AP12: the colour map's uv scroll (units a second); absent = still */
254
+ uvScroll: surfaceUvScroll,
243
255
  });
244
256
  /** A PBR material entry with every default filled. */
245
257
 
@@ -450,7 +462,7 @@ export const SkyDomeSchema: v.GenericSchema<SkyDomeParamsInput, SkyDomeParams> =
450
462
  * One emissive surface: unlit light. `colour` × `intensity` (HDR) × the vertex colours × an optional map, flickering by a
451
463
  * seed, fogged at a share of the fog. With `tube` it draws a neon glyph from a distance field; with `sky`, a sky dome.
452
464
  */
453
- export const EmissiveMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<EmissiveMaterialParamsInput['family'], EmissiveMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['colour'], undefined>, EmissiveMaterialParams['colour']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['colour'], undefined>>>; readonly intensity: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['intensity'], undefined>, EmissiveMaterialParams['intensity']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['intensity'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['vertexColours'], undefined>, EmissiveMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['vertexColours'], undefined>>>; readonly map: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['map'], undefined>, EmissiveMaterialParams['map']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['map'], undefined>>>; readonly blend: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['blend'], undefined>, EmissiveMaterialParams['blend']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['blend'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['doubleSided'], undefined>, EmissiveMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['doubleSided'], undefined>>>; readonly fog: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['fog'], undefined>, EmissiveMaterialParams['fog']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['fog'], undefined>>>; readonly flicker: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['flicker'], undefined>, EmissiveMaterialParams['flicker']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['flicker'], undefined>>>; readonly tube: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['tube'], undefined>, EmissiveMaterialParams['tube']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['tube'], undefined>>>; readonly sky: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['sky'], undefined>, EmissiveMaterialParams['sky']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['sky'], undefined>>>; }, undefined> = v.strictObject({
465
+ export const EmissiveMaterialSchema: v.StrictObjectSchema<{ readonly family: v.GenericSchema<EmissiveMaterialParamsInput['family'], EmissiveMaterialParams['family']>; readonly colour: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['colour'], undefined>, EmissiveMaterialParams['colour']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['colour'], undefined>>>; readonly intensity: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['intensity'], undefined>, EmissiveMaterialParams['intensity']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['intensity'], undefined>>>; readonly vertexColours: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['vertexColours'], undefined>, EmissiveMaterialParams['vertexColours']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['vertexColours'], undefined>>>; readonly map: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['map'], undefined>, EmissiveMaterialParams['map']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['map'], undefined>>>; readonly blend: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['blend'], undefined>, EmissiveMaterialParams['blend']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['blend'], undefined>>>; readonly doubleSided: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['doubleSided'], undefined>, EmissiveMaterialParams['doubleSided']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['doubleSided'], undefined>>>; readonly fog: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['fog'], undefined>, EmissiveMaterialParams['fog']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['fog'], undefined>>>; readonly flicker: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['flicker'], undefined>, EmissiveMaterialParams['flicker']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['flicker'], undefined>>>; readonly tube: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['tube'], undefined>, EmissiveMaterialParams['tube']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['tube'], undefined>>>; readonly sky: v.OptionalSchema<v.GenericSchema<Exclude<EmissiveMaterialParamsInput['sky'], undefined>, EmissiveMaterialParams['sky']>, MaterialSchemaDefault<Exclude<EmissiveMaterialParamsInput['sky'], undefined>>>; readonly card: typeof emissiveCard; readonly motion: typeof emissiveMotion; }, undefined> = v.strictObject({
454
466
  family: v.literal('emissive'),
455
467
  /** sRGB tint */
456
468
  colour: v.optional(srgb, [1, 1, 1]),
@@ -459,8 +471,9 @@ export const EmissiveMaterialSchema: v.StrictObjectSchema<{ readonly family: v.G
459
471
  vertexColours: v.optional(v.boolean(), false),
460
472
  /** an sRGB colour map × tint */
461
473
  map: v.optional(v.nullable(textureRef), null),
462
- /** 'additive' adds light over what is behind it (no depth write); 'opaque' is a surface lit from within */
463
- blend: v.optional(v.picklist(['opaque', 'additive']), 'opaque'),
474
+ /** 'additive' adds light over what is behind it (no depth write); 'alpha' blends its map's alpha over it (AP11: a flame
475
+ * card); 'opaque' is a surface lit from within */
476
+ blend: v.optional(v.picklist(['opaque', 'additive', 'alpha']), 'opaque'),
464
477
  doubleSided: v.optional(v.boolean(), false),
465
478
  /** how much of the fog it takes: transmittance ^ fog (0 = cuts through, 1 = fogged like any surface) */
466
479
  fog: v.optional(unit, 1),
@@ -468,6 +481,10 @@ export const EmissiveMaterialSchema: v.StrictObjectSchema<{ readonly family: v.G
468
481
  flicker: v.optional(v.pipe(nonNegative, v.maxValue(1000)), 0),
469
482
  tube: v.optional(v.nullable(NeonTubeSchema), null),
470
483
  sky: v.optional(v.nullable(SkyDomeSchema), null),
484
+ /** AP11: every vertex is a camera-facing card corner (`position` the seat, `_CORNER` the view-space offset); absent = a surface */
485
+ card: emissiveCard,
486
+ /** AP12: a card's declared motion (pulse, drift, rise); absent = still */
487
+ motion: emissiveMotion,
471
488
  });
472
489
  /** An emissive material entry with every default filled. */
473
490
 
@@ -549,9 +566,9 @@ export interface GroundLayerParamsInput { wind?: [number, number] | undefined; w
549
566
  export interface GroundLayerParams { wind: [number, number]; wavelength: [number, number]; lump: number; depth: [number, number]; relief: [number, number, number]; contrast: { near: number; far: number; window: [number, number]; strength: number; }; fade: [number, number]; slip: [number, number]; flat: [number, number]; patches: { floor: number; near: number; window: [number, number]; }; grain: { map: (string) | null; mean: number; glintMean: number; strength: number; }; macro: [[number, number, number], [number, number, number]]; albedo: number; streaks: { tint: [number, number, number]; amount: number; }; trail: ({ map: string; rect: [number, number, number, number]; ripples: number; tint: [number, number, number]; amount: number; }) | null; keyShadow: ({ map: string; rect: [number, number, number, number]; edge: [number, number]; floor: number; }) | null; terminator: number; crest: { band: [number, number]; gain: number; }; sheen: number; shade: { tint: [number, number, number]; gain: number; lift: [number, number, number]; amount: number; edge: number; floor: [number, number, number]; }; saturation: { flat: number; facing: number; coolTint: [number, number, number]; keep: number; }; away: { from: [number, number]; amount: number; }; pools: ({ low: [number, number, number]; high: [number, number, number]; split: number; radius: number; gain: number; source?: string; }) | null; }
550
567
  export interface MeasureLayerParamsInput { structure?: [number, number, number] | undefined; trim?: [number, number, number] | undefined; floor?: [number, number, number] | undefined; line?: { colour: [number, number, number]; alpha: number; floorAlpha: number; width: number; } | undefined; sub?: { step: number; alpha: number; } | undefined; label?: { colour: [number, number, number]; height: number; } | undefined; lift?: number | undefined; tint?: [number, number, number]; grain?: { amount: [number, number, number]; size: number; }; grid?: [number, number, number]; }
551
568
  export interface MeasureLayerParams { structure: [number, number, number]; trim: [number, number, number]; floor: [number, number, number]; line: { colour: [number, number, number]; alpha: number; floorAlpha: number; width: number; }; sub: { step: number; alpha: number; }; label: { colour: [number, number, number]; height: number; }; lift: number; tint?: [number, number, number]; grain?: { amount: [number, number, number]; size: number; }; grid?: [number, number, number]; }
552
- export interface PbrMaterialParamsInput { family: 'pbr'; colour?: [number, number, number] | undefined; roughness?: number | undefined; metalness?: number | undefined; maps?: { colour: (string) | null; normal: (string) | null; orm: (string) | null; } | undefined; normalScale?: number | undefined; occlusion?: number | undefined; envStrength?: number | undefined; vertexColours?: boolean | undefined; faceted?: boolean | undefined; doubleSided?: boolean | undefined; alphaCutoff?: number | undefined; ground?: (GroundLayerParamsInput) | null | undefined; measure?: (MeasureLayerParamsInput) | null | undefined; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; }
569
+ export interface PbrMaterialParamsInput { family: 'pbr'; colour?: [number, number, number] | undefined; roughness?: number | undefined; metalness?: number | undefined; maps?: { colour: (string) | null; normal: (string) | null; orm: (string) | null; } | undefined; normalScale?: number | undefined; occlusion?: number | undefined; envStrength?: number | undefined; vertexColours?: boolean | undefined; faceted?: boolean | undefined; doubleSided?: boolean | undefined; alphaCutoff?: number | undefined; ground?: (GroundLayerParamsInput) | null | undefined; measure?: (MeasureLayerParamsInput) | null | undefined; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; }
553
570
  // oxlint-disable-next-line typescript/consistent-type-definitions -- Graph admission requires the material alias's implicit dictionary compatibility.
554
- export type PbrMaterialParams = { family: 'pbr'; colour: [number, number, number]; roughness: number; metalness: number; maps: { colour: (string) | null; normal: (string) | null; orm: (string) | null; }; normalScale: number; occlusion: number; envStrength: number; vertexColours: boolean; faceted: boolean; doubleSided: boolean; alphaCutoff: number; ground: (GroundLayerParams) | null; measure: (MeasureLayerParams) | null; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; };
571
+ export type PbrMaterialParams = { family: 'pbr'; colour: [number, number, number]; roughness: number; metalness: number; maps: { colour: (string) | null; normal: (string) | null; orm: (string) | null; }; normalScale: number; occlusion: number; envStrength: number; vertexColours: boolean; faceted: boolean; doubleSided: boolean; alphaCutoff: number; ground: (GroundLayerParams) | null; measure: (MeasureLayerParams) | null; detail?: DetailLayer; emissive?: [number, number, number]; emissiveIntensity?: number; blend?: 'opaque' | 'alpha'; opacity?: number; depthOffset?: number; sway?: SurfaceSway; uvScroll?: [number, number]; };
555
572
  export interface GradeParamsInput { exposure?: number | undefined; gain?: number | undefined; shoulder?: number | undefined; saturation?: number | undefined; shadowTint?: [number, number, number] | undefined; lightTint?: [number, number, number] | undefined; split?: [number, number] | undefined; contrast?: number | undefined; lookSaturation?: number | undefined; }
556
573
  export interface GradeParams { exposure: number; gain: number; shoulder: number; saturation: number; shadowTint: [number, number, number]; lightTint: [number, number, number]; split: [number, number]; contrast: number; lookSaturation: number; }
557
574
  export interface PainterlyLookParamsInput { shade?: [number, number, number] | undefined; rim?: [number, number, number] | undefined; warm?: number | undefined; floor?: number | undefined; wet?: number | undefined; wind?: { direction: [number, number]; strength: number; } | undefined; grade?: (GradeParamsInput) | null | undefined; }
@@ -567,8 +584,8 @@ export interface NeonTubeParamsInput { field: string; fillSpread: number; skelet
567
584
  export interface NeonTubeParams { field: string; fillSpread: number; skeletonSpread: number; mono: number; radius: number; rim: number; thicken: number; seam: number; seamWidth: number; haloReach: number; haloGain: number; core: number; rimShade: number; cell: ([number, number]) | null; }
568
585
  export interface SkyDomeParamsInput { maps: [string, (string) | null]; elevation?: [number, number] | undefined; window?: [number, number] | undefined; firstGain?: [number, number] | undefined; hold?: number | undefined; stars?: { density: number; gain: number; elevation: [number, number]; appear: [number, number]; } | undefined; dither?: number | undefined; }
569
586
  export interface SkyDomeParams { maps: [string, (string) | null]; elevation: [number, number]; window: [number, number]; firstGain: [number, number]; hold: number; stars: { density: number; gain: number; elevation: [number, number]; appear: [number, number]; }; dither: number; }
570
- export interface EmissiveMaterialParamsInput { family: 'emissive'; colour?: [number, number, number] | undefined; intensity?: number | undefined; vertexColours?: boolean | undefined; map?: (string) | null | undefined; blend?: 'opaque' | 'additive' | undefined; doubleSided?: boolean | undefined; fog?: number | undefined; flicker?: number | undefined; tube?: (NeonTubeParamsInput) | null | undefined; sky?: (SkyDomeParamsInput) | null | undefined; }
587
+ export interface EmissiveMaterialParamsInput { family: 'emissive'; colour?: [number, number, number] | undefined; intensity?: number | undefined; vertexColours?: boolean | undefined; map?: (string) | null | undefined; blend?: 'opaque' | 'additive' | 'alpha' | undefined; doubleSided?: boolean | undefined; fog?: number | undefined; flicker?: number | undefined; tube?: (NeonTubeParamsInput) | null | undefined; sky?: (SkyDomeParamsInput) | null | undefined; card?: true; motion?: CardMotion; }
571
588
  // oxlint-disable-next-line typescript/consistent-type-definitions -- Graph admission requires the material alias's implicit dictionary compatibility.
572
- export type EmissiveMaterialParams = { family: 'emissive'; colour: [number, number, number]; intensity: number; vertexColours: boolean; map: (string) | null; blend: 'opaque' | 'additive'; doubleSided: boolean; fog: number; flicker: number; tube: (NeonTubeParams) | null; sky: (SkyDomeParams) | null; };
589
+ export type EmissiveMaterialParams = { family: 'emissive'; colour: [number, number, number]; intensity: number; vertexColours: boolean; map: (string) | null; blend: 'opaque' | 'additive' | 'alpha'; doubleSided: boolean; fog: number; flicker: number; tube: (NeonTubeParams) | null; sky: (SkyDomeParams) | null; card?: true; motion?: CardMotion; };
573
590
  export type FamilyMaterialParamsInput = (ToonMaterialParamsInput) | (PbrMaterialParamsInput) | (PainterlyMaterialParamsInput) | (EmissiveMaterialParamsInput);
574
591
  export type FamilyMaterialParams = (ToonMaterialParams) | (PbrMaterialParams) | (PainterlyMaterialParams) | (EmissiveMaterialParams);
@@ -0,0 +1,160 @@
1
+ /**
2
+ * What a three.js scene says about a surface that a shard could not say before (meta SHARD-SOURCE AP10 to AP12): the
3
+ * cleanroom's alpha decals, its camera-facing flame and glow cards, its fireflies and sparks, and the motion an author
4
+ * declares with `animate(...)` (the sdk's scene compiler writes these; no shard code runs at runtime). Each key is absent
5
+ * by default and no default is filled, so an older shard file keeps its bytes.
6
+ *
7
+ * PBR family:
8
+ * - `blend: 'alpha'`: a see-through surface (a stencil, a sign, a decal), drawn after the opaque world, back to front, with
9
+ * no depth write; `opacity` scales its alpha (absent 1).
10
+ * - `depthOffset`: a polygon offset in depth units (negative pulls the surface toward the camera): a decal on a wall.
11
+ * - `sway`: foliage in the wind. Each vertex moves by its `_SWAY` vertex channel (metres, one float: 0 at the root) along
12
+ * `direction` (x, z) at about `rate` hertz, its phase taken from where it stands.
13
+ * - `uvScroll`: the colour map's uv moves this many units a second (u, v): running water, drifting cloud shadow.
14
+ *
15
+ * Emissive family:
16
+ * - `blend: 'alpha'` (beside `opaque` and `additive`): an unlit card blended over what is behind it (a flame tongue).
17
+ * - `card: true`: every vertex is a card corner: `position` is the card's seat (world), its `_CORNER` vertex channel
18
+ * (two floats, metres) the corner's offset in view space, so the card always faces the camera (a three.js `Sprite`,
19
+ * or one `Points` point drawn as a quad).
20
+ * - `motion` (cards only): `pulse` (the card breathes: height by `amount` at `rate` hertz, a fire's tongue), `drift` (the
21
+ * seat wanders `radius` metres round itself: fireflies) or `rise` (the seat climbs `height` metres in 1 / `rate`
22
+ * seconds, spreading `spread` metres and fading out: sparks). Each card's phase comes from its seat.
23
+ *
24
+ * Plain data and checks, no three.js.
25
+ */
26
+ import {
27
+ exactOptional,
28
+ finite,
29
+ literal,
30
+ maxValue,
31
+ minValue,
32
+ number,
33
+ picklist,
34
+ pipe,
35
+ strictObject,
36
+ tuple,
37
+ variant,
38
+ } from 'valibot'
39
+
40
+ import type { ExactOptionalSchema, GenericSchema } from 'valibot'
41
+
42
+ const NONE = 0
43
+ const FULL = 1
44
+ const DEPTH_OFFSET_MAX = 16
45
+ const SWAY_RATE_MAX = 8
46
+ const UV_SCROLL_MAX = 10
47
+ const MOTION_RATE_MAX = 30
48
+ const DRIFT_RADIUS_MAX = 10
49
+ const RISE_HEIGHT_MAX = 50
50
+ const RISE_SPREAD_MAX = 10
51
+ const PULSE_AMOUNT_MAX = 1
52
+
53
+ /** The PBR family's `sway`: wind along `direction` (x, z) at about `rate` hertz; amplitude per vertex is `_SWAY`. */
54
+ interface SurfaceSway {
55
+ rate: number
56
+ direction: [number, number]
57
+ }
58
+ /** A card's declared motion. */
59
+ type CardMotion =
60
+ | { kind: 'pulse'; rate: number; amount: number }
61
+ | { kind: 'drift'; rate: number; radius: number }
62
+ | { kind: 'rise'; rate: number; height: number; spread: number }
63
+
64
+ const real = pipe(number(), finite())
65
+ const range = (low: number, high: number): GenericSchema<number, number> =>
66
+ pipe(real, minValue(low), maxValue(high))
67
+ const unit = range(NONE, FULL)
68
+ const rate = range(NONE, MOTION_RATE_MAX)
69
+
70
+ const SurfaceBlendSchema: GenericSchema<
71
+ 'opaque' | 'alpha',
72
+ 'opaque' | 'alpha'
73
+ > = picklist(['opaque', 'alpha'])
74
+ const SurfaceSwaySchema: GenericSchema<SurfaceSway, SurfaceSway> = strictObject(
75
+ {
76
+ rate: range(NONE, SWAY_RATE_MAX),
77
+ direction: tuple([range(-FULL, FULL), range(-FULL, FULL)]),
78
+ },
79
+ )
80
+ const UvScrollSchema: GenericSchema<[number, number], [number, number]> = tuple(
81
+ [range(-UV_SCROLL_MAX, UV_SCROLL_MAX), range(-UV_SCROLL_MAX, UV_SCROLL_MAX)],
82
+ )
83
+ const CardMotionSchema: GenericSchema<CardMotion, CardMotion> = variant(
84
+ 'kind',
85
+ [
86
+ strictObject({
87
+ kind: literal('pulse'),
88
+ rate,
89
+ amount: range(NONE, PULSE_AMOUNT_MAX),
90
+ }),
91
+ strictObject({
92
+ kind: literal('drift'),
93
+ rate,
94
+ radius: range(NONE, DRIFT_RADIUS_MAX),
95
+ }),
96
+ strictObject({
97
+ kind: literal('rise'),
98
+ rate,
99
+ height: range(NONE, RISE_HEIGHT_MAX),
100
+ spread: range(NONE, RISE_SPREAD_MAX),
101
+ }),
102
+ ],
103
+ )
104
+
105
+ /** PBR `blend`: absent is opaque. */
106
+ const surfaceBlend: ExactOptionalSchema<
107
+ GenericSchema<'opaque' | 'alpha', 'opaque' | 'alpha'>,
108
+ undefined
109
+ > = exactOptional(SurfaceBlendSchema)
110
+ /** PBR `opacity`: the alpha blend's scale; absent 1. */
111
+ const surfaceOpacity: ExactOptionalSchema<
112
+ GenericSchema<number, number>,
113
+ undefined
114
+ > = exactOptional(unit)
115
+ /** PBR `depthOffset`: polygon offset factor and units. */
116
+ const surfaceDepthOffset: ExactOptionalSchema<
117
+ GenericSchema<number, number>,
118
+ undefined
119
+ > = exactOptional(range(-DEPTH_OFFSET_MAX, DEPTH_OFFSET_MAX))
120
+ /** PBR `sway`. */
121
+ const surfaceSway: ExactOptionalSchema<
122
+ GenericSchema<SurfaceSway, SurfaceSway>,
123
+ undefined
124
+ > = exactOptional(SurfaceSwaySchema)
125
+ /** PBR `uvScroll`. */
126
+ const surfaceUvScroll: ExactOptionalSchema<
127
+ GenericSchema<[number, number], [number, number]>,
128
+ undefined
129
+ > = exactOptional(UvScrollSchema)
130
+ /** Emissive `card`. */
131
+ const emissiveCard: ExactOptionalSchema<
132
+ GenericSchema<true, true>,
133
+ undefined
134
+ > = exactOptional(literal(true))
135
+ /** Emissive `motion`. */
136
+ const emissiveMotion: ExactOptionalSchema<
137
+ GenericSchema<CardMotion, CardMotion>,
138
+ undefined
139
+ > = exactOptional(CardMotionSchema)
140
+
141
+ /** The vertex channel a swaying surface reads (GLB application attribute `_SWAY`, one float, metres). */
142
+ const SWAY_CHANNEL = '_SWAY'
143
+ /** The vertex channel a card reads (GLB application attribute `_CORNER`, two floats, metres in view space). */
144
+ const CORNER_CHANNEL = '_CORNER'
145
+
146
+ export {
147
+ CORNER_CHANNEL,
148
+ CardMotionSchema,
149
+ SWAY_CHANNEL,
150
+ SurfaceSwaySchema,
151
+ UvScrollSchema,
152
+ emissiveCard,
153
+ emissiveMotion,
154
+ surfaceBlend,
155
+ surfaceDepthOffset,
156
+ surfaceOpacity,
157
+ surfaceSway,
158
+ surfaceUvScroll,
159
+ }
160
+ export type { CardMotion, SurfaceSway }
@@ -51,8 +51,10 @@ import { AccentSchema } from './accent.ts';
51
51
  import { MapSchema, PresentationSchema } from './presentation.ts';
52
52
  import { MigrationsSchema, migrationRules } from './migrations.ts';
53
53
  import { skinLookRules } from './skinAssets.ts';
54
- import { MaterialsSchema, FamilyLooksSchema, MaterialCurvesSchema, TextureSamplersSchema, materialExists, materialTextureRefs, materialGraphRules, materialCurveRules, textureSamplerRules } from './materials.ts';
54
+ import { MaterialsSchema, FamilyLooksSchema, MaterialCurvesSchema, TextureSamplersSchema, materialExists, materialTextureRefs, materialGraphRules, materialCurveRules, textureSamplerRules, graphBindingSources } from './materials.ts';
55
55
  import { PostStackSchema, postStackRules } from './postStack.ts';
56
+ import { LookSkySchema, lookSkyRules } from './look-sky.ts';
57
+ import type { LookSky, LookSkyInput } from './look-sky.ts';
56
58
  import { LookBloomSchema, LookLightSchema, LookToneSchema } from './look-light.ts';
57
59
  import { LookVignetteSchema } from './look-render.ts';
58
60
  import type { LookBloom, LookBloomInput, LookLight, LookLightInput, LookTone } from './look-light.ts';
@@ -76,7 +78,7 @@ const rawSchema: v.GenericSchema<ShardfileRowsInput, ShardfileRows> & { readonly
76
78
  map: v.exactOptional(MapSchema),
77
79
  requires: RequiresSchema,
78
80
  budgets: BudgetsSchema,
79
- look: v.strictObject({ families: names, materials: v.optional(MaterialsSchema, {}), familyLooks: v.optional(FamilyLooksSchema, {}), curves: v.exactOptional(MaterialCurvesSchema), samplers: v.exactOptional(TextureSamplersSchema), post: v.exactOptional(PostStackSchema), light: v.exactOptional(LookLightSchema), grade: lookGrade, clock: v.literal('engine'), day: v.optional(day), dayOverride: v.nullable(channel), keys: v.pipe(v.array(key), v.maxLength(64)) }),
81
+ look: v.strictObject({ families: names, materials: v.optional(MaterialsSchema, {}), familyLooks: v.optional(FamilyLooksSchema, {}), curves: v.exactOptional(MaterialCurvesSchema), samplers: v.exactOptional(TextureSamplersSchema), post: v.exactOptional(PostStackSchema), sky: v.exactOptional(LookSkySchema), light: v.exactOptional(LookLightSchema), grade: lookGrade, clock: v.literal('engine'), day: v.optional(day), dayOverride: v.nullable(channel), keys: v.pipe(v.array(key), v.maxLength(64)) }),
80
82
  sim: SimSchema,
81
83
  state: StateSchema,
82
84
  migrations: v.optional(MigrationsSchema, []),
@@ -185,6 +187,7 @@ export interface Shardfile {
185
187
  curves?: v.InferOutput<typeof MaterialCurvesSchema>;
186
188
  samplers?: v.InferOutput<typeof TextureSamplersSchema>;
187
189
  post?: v.InferOutput<typeof PostStackSchema>;
190
+ sky?: LookSky;
188
191
  light?: LookLight;
189
192
  grade: { exposure: number; saturation: number; contrast: number; lut: string | null; bloom?: LookBloom; tone?: LookTone; vignette?: LookVignette };
190
193
  clock: 'engine';
@@ -252,7 +255,7 @@ export function shardfileRules(s: Shardfile): string[] {
252
255
  errors.push(...stateRules(s.state));
253
256
  if ((s.clientChannels?.length ?? 0) > 0 && !pageOwner && s.runtime?.binds?.includes('clientChannels') !== true) errors.push('native visual channels require their declared page or runtime owner');
254
257
  if (s.runtime?.binds?.includes('state') === true && (s.state.player.length > 0 || s.state.shared.some((field) => field.privacy !== 'host' && !(field.privacy === 'public' && field.type !== 'string' && (s.runtime?.spawns?.bosses.length ?? 0) > 0)))) errors.push('runtime-bound state supports host fields and retained-actor numeric fields');
255
- errors.push(...materialGraphRules(s), ...materialCurveRules(s), ...textureSamplerRules(s.look, s.files), ...postStackRules(s));
258
+ errors.push(...materialGraphRules(s), ...materialCurveRules(s), ...textureSamplerRules(s.look, s.files), ...postStackRules(s), ...lookSkyRules(s.look.sky?.graph, graphBindingSources(s)));
256
259
  const materialRefs = materialTextureRefs(s.look.materials), libraryClosure = new Set<string>();
257
260
  const libraryPending = [...s.library];
258
261
  while (libraryPending.length > 0) {
@@ -392,6 +395,7 @@ interface ShardfileRowsInputFields {
392
395
  curves?: v.InferInput<typeof MaterialCurvesSchema>;
393
396
  samplers?: v.InferInput<typeof TextureSamplersSchema>;
394
397
  post?: v.InferInput<typeof PostStackSchema>;
398
+ sky?: LookSkyInput;
395
399
  light?: LookLightInput;
396
400
  grade: {
397
401
  exposure: v.InferInput<typeof finite>;
@@ -468,6 +472,7 @@ interface ShardfileRowsFields {
468
472
  curves?: v.InferOutput<typeof MaterialCurvesSchema>;
469
473
  samplers?: v.InferOutput<typeof TextureSamplersSchema>;
470
474
  post?: v.InferOutput<typeof PostStackSchema>;
475
+ sky?: LookSky;
471
476
  light?: LookLight;
472
477
  grade: {
473
478
  exposure: v.InferOutput<typeof finite>;