@anov/gis-skills-cli 0.0.0-stage → 0.3.3

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 (57) hide show
  1. package/CHANGELOG.md +637 -0
  2. package/INSTALL.md +481 -0
  3. package/LICENSE +15 -0
  4. package/README.md +148 -2
  5. package/RELEASING.md +162 -0
  6. package/bin/anov-gis-skills.mjs +470 -0
  7. package/lib/mcp-config.mjs +273 -0
  8. package/package.json +43 -4
  9. package/skills/anovgis-analysis/SKILL.md +585 -0
  10. package/skills/anovgis-effects/SKILL.md +260 -0
  11. package/skills/anovgis-imagery-terrain/SKILL.md +505 -0
  12. package/skills/anovgis-layers/SKILL.md +627 -0
  13. package/skills/anovgis-materials/SKILL.md +635 -0
  14. package/skills/anovgis-models-3dtiles/SKILL.md +448 -0
  15. package/skills/anovgis-pitfalls/SKILL.md +561 -0
  16. package/skills/anovgis-popup-widget/SKILL.md +474 -0
  17. package/skills/anovgis-primitives/SKILL.md +482 -0
  18. package/skills/anovgis-vector-graphics/SKILL.md +602 -0
  19. package/skills/anovgis-viewer/SKILL.md +618 -0
  20. package/skills/using-anovgis/DEMO-MAP.md +64 -0
  21. package/skills/using-anovgis/DEMO-SKILL-MAP.md +248 -0
  22. package/skills/using-anovgis/DOMAINS.md +183 -0
  23. package/skills/using-anovgis/REFERENCE.md +114 -0
  24. package/skills/using-anovgis/SKILL.md +392 -0
  25. package/skills/using-anovgis/templates/README.md +154 -0
  26. package/skills/using-anovgis/templates/combo1-vue3-vite.md +295 -0
  27. package/skills/using-anovgis/templates/combo2-vue2-cli.md +119 -0
  28. package/skills/using-anovgis/templates/combo3-html-cdn.md +107 -0
  29. package/skills/using-anovgis/templates/combo4-vanilla-webpack.md +91 -0
  30. package/skills/using-anovgis/templates/wizard-profiles.md +105 -0
  31. package/vendor/cesiumjs-skills/LICENSE +201 -0
  32. package/vendor/cesiumjs-skills/NOTICE +18 -0
  33. package/vendor/cesiumjs-skills/skills/cesiumjs-3d-tiles/SKILL.md +465 -0
  34. package/vendor/cesiumjs-skills/skills/cesiumjs-camera/SKILL.md +500 -0
  35. package/vendor/cesiumjs-skills/skills/cesiumjs-core-utilities/SKILL.md +403 -0
  36. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/REFERENCE.md +397 -0
  37. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/SKILL.md +351 -0
  38. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/01-diffuse-tint.js +38 -0
  39. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/02-texture-swap.js +42 -0
  40. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/03-feature-id-tileset.js +29 -0
  41. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/04-translucent-override.js +37 -0
  42. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/05-vertex-displacement.js +49 -0
  43. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/06-metadata-ramp.js +34 -0
  44. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/07-voxel-shader.js +27 -0
  45. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/README.md +19 -0
  46. package/vendor/cesiumjs-skills/skills/cesiumjs-custom-shader/examples/_sandcastle-template.html +9 -0
  47. package/vendor/cesiumjs-skills/skills/cesiumjs-entities/SKILL.md +389 -0
  48. package/vendor/cesiumjs-skills/skills/cesiumjs-imagery/SKILL.md +471 -0
  49. package/vendor/cesiumjs-skills/skills/cesiumjs-interaction/SKILL.md +423 -0
  50. package/vendor/cesiumjs-skills/skills/cesiumjs-materials-shaders/SKILL.md +292 -0
  51. package/vendor/cesiumjs-skills/skills/cesiumjs-models-particles/SKILL.md +423 -0
  52. package/vendor/cesiumjs-skills/skills/cesiumjs-primitives/SKILL.md +537 -0
  53. package/vendor/cesiumjs-skills/skills/cesiumjs-spatial-math/SKILL.md +358 -0
  54. package/vendor/cesiumjs-skills/skills/cesiumjs-terrain-environment/SKILL.md +401 -0
  55. package/vendor/cesiumjs-skills/skills/cesiumjs-time-properties/SKILL.md +353 -0
  56. package/vendor/cesiumjs-skills/skills/cesiumjs-viewer-setup/SKILL.md +434 -0
  57. package/vendor/cesiumjs-skills/skills/using-cesiumjs-skills/SKILL.md +35 -0
@@ -0,0 +1,292 @@
1
+ ---
2
+ name: cesiumjs-materials-shaders
3
+ description: "CesiumJS materials and post-processing — Material, Fabric JSON, MaterialAppearance, ImageBasedLighting, PostProcessStage, PostProcessStageLibrary, bloom, depth of field, ambient occlusion, FXAA, tonemapping, BlendingState. Use when defining Fabric materials for entities or primitives, configuring PBR image-based lighting, or adding screen-space post-processing effects."
4
+ ---
5
+ # CesiumJS Materials, Shaders & Post-Processing
6
+
7
+ Version baseline: CesiumJS 1.142 (June 2026). All imports use ES module style.
8
+
9
+ ## Material System (Fabric JSON)
10
+
11
+ `Material` defines surface appearance for **Primitives** through a JSON schema called Fabric. Materials compile to GLSL and are consumed by `MaterialAppearance` or `PolylineMaterialAppearance`.
12
+
13
+ ### Built-in Material Types
14
+
15
+ **Surface:** `Color` (color), `Image` (image, repeat), `DiffuseMap`, `AlphaMap`, `SpecularMap`, `EmissionMap` (image, channel(s), repeat), `BumpMap`, `NormalMap` (image, channel(s), strength, repeat).
16
+
17
+ **Patterns:** `Grid` (color, cellAlpha, lineCount, lineThickness), `Stripe` (evenColor, oddColor, repeat), `Checkerboard` (lightColor, darkColor, repeat), `Dot` (lightColor, darkColor, repeat).
18
+
19
+ **Effects:** `Water` (baseWaterColor, normalMap, frequency, animationSpeed), `RimLighting` (color, rimColor, width), `Fade` (fadeInColor, fadeOutColor, maximumDistance).
20
+
21
+ **Terrain:** `ElevationContour` (color, spacing, width), `ElevationRamp` (image, minimumHeight, maximumHeight).
22
+
23
+ **Polyline:** `PolylineArrow` (color), `PolylineDash` (color, gapColor, dashLength, dashPattern), `PolylineGlow` (color, glowPower, taperPower), `PolylineOutline` (color, outlineColor, outlineWidth).
24
+
25
+ ### Creating Materials
26
+
27
+ ```js
28
+ import { Material, Color, Cartesian2 } from "cesium";
29
+
30
+ // Shorthand with fromType (preferred for built-in types)
31
+ const colorMat = Material.fromType("Color", { color: new Color(1.0, 0.0, 0.0, 0.5) });
32
+
33
+ // Full Fabric notation
34
+ const gridMat = new Material({
35
+ fabric: {
36
+ type: "Grid",
37
+ uniforms: { color: Color.GREEN, cellAlpha: 0.1, lineCount: new Cartesian2(8, 8) },
38
+ },
39
+ });
40
+
41
+ // Async loading -- awaits textures before first frame, no flicker
42
+ const imageMat = await Material.fromTypeAsync("Image", { image: "./textures/facade.png" });
43
+ ```
44
+
45
+ ### Custom Fabric with GLSL Source
46
+
47
+ Use `source` for inline GLSL. Uniforms declared in `uniforms` are available by name in the shader.
48
+
49
+ ```js
50
+ import { Material, Color } from "cesium";
51
+
52
+ const pulseMaterial = new Material({
53
+ fabric: {
54
+ uniforms: { color: Color.CYAN, speed: 2.0 },
55
+ source: `czm_material czm_getMaterial(czm_materialInput materialInput) {
56
+ czm_material material = czm_getDefaultMaterial(materialInput);
57
+ float pulse = sin(czm_frameNumber * speed * 0.01) * 0.5 + 0.5;
58
+ material.diffuse = color.rgb;
59
+ material.alpha = color.a * pulse;
60
+ return material;
61
+ }`,
62
+ },
63
+ translucent: true,
64
+ });
65
+ ```
66
+
67
+ ### Applying Materials to Primitives
68
+
69
+ ```js
70
+ import { Primitive, GeometryInstance, RectangleGeometry, Rectangle,
71
+ MaterialAppearance, Material, Color, Cartesian2 } from "cesium";
72
+
73
+ viewer.scene.primitives.add(new Primitive({
74
+ geometryInstances: new GeometryInstance({
75
+ geometry: new RectangleGeometry({ rectangle: Rectangle.fromDegrees(-100, 30, -90, 40) }),
76
+ }),
77
+ appearance: new MaterialAppearance({
78
+ material: Material.fromType("Checkerboard", {
79
+ lightColor: Color.WHITE, darkColor: Color.BLACK, repeat: new Cartesian2(4, 4),
80
+ }),
81
+ }),
82
+ }));
83
+ ```
84
+
85
+ ### Compositing Sub-Materials (Fabric `materials` + `components`)
86
+
87
+ ```js
88
+ import { Material, Color } from "cesium";
89
+
90
+ const compositeMat = new Material({ fabric: {
91
+ materials: {
92
+ gridMaterial: { type: "Grid" },
93
+ colorMaterial: { type: "Color", uniforms: { color: Color.BLUE } },
94
+ },
95
+ components: {
96
+ diffuse: "gridMaterial.diffuse + 0.2 * colorMaterial.diffuse",
97
+ alpha: "min(gridMaterial.alpha, colorMaterial.alpha)",
98
+ },
99
+ }});
100
+ ```
101
+
102
+ ## CustomShader
103
+
104
+ `CustomShader` injects user GLSL into `Model`, `Cesium3DTileset`, and `VoxelPrimitive` rendering, with access to vertex attributes, feature IDs, and `EXT_structural_metadata`.
105
+
106
+ **For shader authoring — struct reference, metadata access, feature IDs, voxel subset, 1.139 breaking changes, and seven worked examples — see the `cesiumjs-custom-shader` skill.** This skill owns the `CustomShader` integration surface; the authoring depth lives there.
107
+
108
+ Minimal example:
109
+
110
+ ```js
111
+ import { CustomShader, Model } from "cesium";
112
+
113
+ const shader = new CustomShader({
114
+ fragmentShaderText: `
115
+ void fragmentMain(FragmentInput fsInput, inout czm_modelMaterial material) {
116
+ material.diffuse = vec3(1.0, 0.5, 0.0);
117
+ }
118
+ `,
119
+ });
120
+ const model = await Model.fromGltfAsync({ url: "./building.glb", customShader: shader });
121
+ viewer.scene.primitives.add(model);
122
+ ```
123
+
124
+ ## ImageBasedLighting
125
+
126
+ Controls PBR image-based lighting for `Model` and `Cesium3DTileset`. `imageBasedLightingFactor` (Cartesian2) scales diffuse (x) and specular (y) from 0 to 1. Diffuse comes from `sphericalHarmonicCoefficients` (array of 9 Cartesian3, L0-L2). Specular comes from `specularEnvironmentMaps` (URL to KTX2 cube map).
127
+
128
+ ```js
129
+ import { ImageBasedLighting, Cartesian2, Cartesian3 } from "cesium";
130
+
131
+ const coefficients = [ // 9 Cartesian3 values for L0..L2 bands
132
+ new Cartesian3(0.35, 0.35, 0.38), new Cartesian3(0.11, 0.11, 0.11),
133
+ new Cartesian3(0.04, 0.04, 0.04), new Cartesian3(-0.08, -0.08, -0.08),
134
+ new Cartesian3(-0.02, -0.02, -0.02), new Cartesian3(0.04, 0.04, 0.04),
135
+ new Cartesian3(-0.06, -0.06, -0.06), new Cartesian3(0.01, 0.01, 0.01),
136
+ new Cartesian3(-0.03, -0.03, -0.03),
137
+ ];
138
+ const ibl = new ImageBasedLighting({
139
+ imageBasedLightingFactor: new Cartesian2(1.0, 1.0),
140
+ sphericalHarmonicCoefficients: coefficients,
141
+ specularEnvironmentMaps: "./environment/specular.ktx2",
142
+ });
143
+ const model = await Cesium.Model.fromGltfAsync({ url: "./helmet.glb", imageBasedLighting: ibl });
144
+ viewer.scene.primitives.add(model);
145
+ // Disable: model.imageBasedLighting.imageBasedLightingFactor = new Cartesian2(0.0, 0.0);
146
+ ```
147
+
148
+ ## Post-Processing
149
+
150
+ Screen-space pipeline via `viewer.scene.postProcessStages` (`PostProcessStageCollection`). Stages execute in order; each reads `colorTexture` and `depthTexture`.
151
+
152
+ ### Built-in Effects (PostProcessStageLibrary)
153
+
154
+ `createBlurStage()` (delta, sigma, stepSize), `createDepthOfFieldStage()` (focalDistance, delta, sigma, stepSize), `createEdgeDetectionStage()` (color, length), `createSilhouetteStage()` (color, length), `createBlackAndWhiteStage()` (gradations), `createBrightnessStage()` (brightness), `createNightVisionStage()`, `createLensFlareStage()` (intensity, distortion, ghostDispersal, haloWidth).
155
+
156
+ ### Collection Stages (Bloom, AO, FXAA, Tonemapping)
157
+
158
+ Bloom, ambient occlusion, and FXAA are accessed directly on the collection (not via the library). Tonemapping defaults to `PBR_NEUTRAL`.
159
+
160
+ ```js
161
+ import { Tonemapper, PostProcessStageLibrary } from "cesium";
162
+
163
+ // Bloom
164
+ viewer.scene.postProcessStages.bloom.enabled = true;
165
+ viewer.scene.postProcessStages.bloom.uniforms.contrast = 128.0;
166
+ viewer.scene.postProcessStages.bloom.uniforms.brightness = -0.3;
167
+
168
+ // Ambient Occlusion (HBAO)
169
+ viewer.scene.postProcessStages.ambientOcclusion.enabled = true;
170
+ viewer.scene.postProcessStages.ambientOcclusion.uniforms.intensity = 3.0;
171
+
172
+ // FXAA
173
+ viewer.scene.postProcessStages.fxaa.enabled = true;
174
+
175
+ // Tonemapping: REINHARD, MODIFIED_REINHARD, FILMIC, ACES, PBR_NEUTRAL (default)
176
+ viewer.scene.postProcessStages.tonemapper = Tonemapper.ACES;
177
+ viewer.scene.postProcessStages.exposure = 1.2; // <1 darker, >1 brighter
178
+
179
+ // Depth of field (added via library)
180
+ const dof = viewer.scene.postProcessStages.add(
181
+ PostProcessStageLibrary.createDepthOfFieldStage()
182
+ );
183
+ dof.uniforms.focalDistance = 500.0; // meters from camera
184
+ dof.uniforms.sigma = 3.8;
185
+ ```
186
+
187
+ ### Custom PostProcessStage
188
+
189
+ Custom stages receive `colorTexture`, `depthTexture` (sampler2D) and `v_textureCoordinates` (vec2). Output via `out_FragColor`. Uniforms can be constants or functions (re-evaluated each frame).
190
+
191
+ ```js
192
+ import { PostProcessStage } from "cesium";
193
+
194
+ const sepia = viewer.scene.postProcessStages.add(new PostProcessStage({
195
+ fragmentShader: `
196
+ uniform sampler2D colorTexture; in vec2 v_textureCoordinates; uniform float intensity;
197
+ void main() {
198
+ vec4 c = texture(colorTexture, v_textureCoordinates);
199
+ float gray = dot(c.rgb, vec3(0.299, 0.587, 0.114));
200
+ out_FragColor = vec4(mix(c.rgb, gray * vec3(1.2, 1.0, 0.8), intensity), c.a);
201
+ }`,
202
+ uniforms: { intensity: () => 0.8 }, // function uniform, re-evaluated each frame
203
+ }));
204
+ ```
205
+
206
+ ### Selected Feature Highlighting
207
+
208
+ Use `czm_selected()` in the fragment shader and assign features to `stage.selected`.
209
+
210
+ ```js
211
+ import { PostProcessStage, Color } from "cesium";
212
+
213
+ const highlight = viewer.scene.postProcessStages.add(new PostProcessStage({
214
+ fragmentShader: `
215
+ uniform sampler2D colorTexture; in vec2 v_textureCoordinates; uniform vec4 highlight;
216
+ void main() {
217
+ vec4 color = texture(colorTexture, v_textureCoordinates);
218
+ if (czm_selected()) {
219
+ out_FragColor = vec4(mix(color.rgb, highlight.rgb, highlight.a), 1.0);
220
+ } else { out_FragColor = color; }
221
+ }`,
222
+ uniforms: { highlight: () => new Color(1.0, 1.0, 0.0, 0.5) },
223
+ }));
224
+ highlight.selected = [pickedFeature];
225
+ ```
226
+
227
+ ### PostProcessStageComposite
228
+
229
+ ```js
230
+ import { PostProcessStage, PostProcessStageComposite, PostProcessStageLibrary } from "cesium";
231
+
232
+ const blur = PostProcessStageLibrary.createBlurStage();
233
+ const combine = new PostProcessStage({
234
+ fragmentShader: `
235
+ uniform sampler2D colorTexture; uniform sampler2D blurTexture;
236
+ in vec2 v_textureCoordinates;
237
+ void main() {
238
+ vec4 orig = texture(colorTexture, v_textureCoordinates);
239
+ vec4 blurred = texture(blurTexture, v_textureCoordinates);
240
+ out_FragColor = mix(orig, blurred, 0.5);
241
+ }`,
242
+ uniforms: { blurTexture: blur.name }, // reference another stage's output by name
243
+ });
244
+ viewer.scene.postProcessStages.add(new PostProcessStageComposite({
245
+ stages: [blur, combine],
246
+ inputPreviousStageTexture: false, // both read the original scene texture
247
+ }));
248
+ ```
249
+
250
+ ### Managing Stages
251
+
252
+ ```js
253
+ viewer.scene.postProcessStages.remove(sepia); // remove specific stage
254
+ dof.enabled = false; // disable without removing
255
+ viewer.scene.postProcessStages.removeAll(); // remove all custom stages
256
+ ```
257
+
258
+ ## BlendingState
259
+
260
+ Predefined blending presets for `Appearance.renderState` on Primitives.
261
+
262
+ | Preset | Behavior |
263
+ |--------|---------|
264
+ | `BlendingState.DISABLED` | No blending |
265
+ | `BlendingState.ALPHA_BLEND` | Standard alpha: `src*srcA + dst*(1-srcA)` |
266
+ | `BlendingState.PRE_MULTIPLIED_ALPHA_BLEND` | Premultiplied: `src + dst*(1-srcA)` |
267
+ | `BlendingState.ADDITIVE_BLEND` | Additive: `src*srcA + dst` |
268
+
269
+ ```js
270
+ import { MaterialAppearance, BlendingState, Material, Color } from "cesium";
271
+
272
+ const appearance = new MaterialAppearance({
273
+ material: Material.fromType("Color", { color: Color.RED.withAlpha(0.5) }),
274
+ renderState: { depthTest: { enabled: true }, blending: BlendingState.ALPHA_BLEND },
275
+ });
276
+ ```
277
+
278
+ ## Performance Tips
279
+
280
+ 1. Prefer `Material.fromType()` for built-in types -- cached shader programs avoid recompilation.
281
+ 2. Use `Material.fromTypeAsync()` for texture materials to prevent default-texture flicker.
282
+ 3. Set `PostProcessStage.textureScale` below 1.0 (e.g., 0.5) to reduce pixels processed in expensive stages.
283
+ 4. Disable unused built-in stages (`bloom.enabled = false`) -- enabled stages consume GPU resources.
284
+ 5. Combine effects in a `PostProcessStageComposite` to reduce intermediate texture allocations.
285
+ 6. Minimize `PostProcessStage` count -- each requires a full-screen draw call and framebuffer.
286
+
287
+ ## See Also
288
+
289
+ - **cesiumjs-custom-shader** -- GLSL authoring for `Model.customShader`, `Cesium3DTileset.customShader`, `VoxelPrimitive.customShader` (struct reference, metadata, feature IDs)
290
+ - **cesiumjs-primitives** -- Geometry, Appearances, and Material application on Primitive API objects
291
+ - **cesiumjs-3d-tiles** -- Cesium3DTileset loading and styling
292
+ - **cesiumjs-models-particles** -- Model loading and glTF