cesiumgs/cesiumjs-skills/cesiumjs-primitives
Claude Code and agent skill by cesiumgs/cesiumjs-skills
- community
Checking that the SKILL.md file is still in the repository.
CesiumJS primitives and geometry - Primitive, GeometryInstance, Appearance, BufferPrimitive collections, GeoJsonPrimitive, Billboard/Label/PointPrimitive collections, built-in geometry shapes, ground primitives, classification. Use when rendering performance-critical static or vector geometry, loading GeoJSON without entities, creating custom shapes, batching draw calls, or using low-level collections.
Install
npx vskill@latest install cesiumgs/cesiumjs-skills/cesiumjs-primitivesSKILL.md
CesiumJS Primitives & Geometry
Applies to: CesiumJS v1.144+ (ES module imports,??instead ofdefaultValue)
Architecture
The Primitive API is the low-level rendering layer beneath the Entity API, trading convenience for performance.
Core formula: Primitive = GeometryInstance[] + Appearance
- GeometryInstance -- positions a Geometry in world space with per-instance attributes (color, show).
- Geometry -- vertex data describing a shape (polygon, box, ellipsoid, etc.).
- Appearance -- GLSL shaders + render state + optional Material that shade the geometry.
Primitives are immutable after first render -- geometry cannot change, but per-instance attributes update via primitive.getGeometryInstanceAttributes(id).
Primitive
Key Options
| Option | Default | Purpose | |
|---|---|---|---|
geometryInstances | -- | Single instance or array | |
appearance | -- | Shading (Appearance subclass) | |
show | true | Toggle visibility | |
modelMatrix | Matrix4.IDENTITY | Transform all instances | |
asynchronous | true | Build geometry on web worker | |
releaseGeometryInstances | true | Free geometry after GPU upload | |
allowPicking | true | false saves GPU memory | |
shadows | ShadowMode.DISABLED | Cast/receive shadows |
Batching Multiple Instances
All instances in one Primitive share a single draw call.
Batching Volume Geometry (CylinderGeometry Grid)
Volume geometry (Cylinder, Box, Ellipsoid) must be positioned via modelMatrix on each GeometryInstance. Use Matrix4.multiply to combine a world-space anchor with a local offset, then batch all instances into one Primitive.
Key patterns:
Matrix4.multiply(anchorFrame, Matrix4.fromTranslation(offset, result), result)-- compose the ENU frame at a geographic anchor with a local East/North/Up translation.Color.fromRandom({ alpha: 1.0 })produces fully-opaque random colours suitable for rainbow-coloured batches.- Framing matters: for a grid of vertical volumes, prefer a
~-45°(-CesiumMath.PI_OVER_FOUR, ~-0.785rad) pitch at a range of roughly3 * gridFootprint. Pitches shallower than ~-0.6rad can push the grid off-screen or hide it behind buildings; nadir views flatten cylinders into dots and lose the batched "field" appearance. A-0.61rad pitch is still shallow enough to leave the grid completely out of frame. - Verify visibility: after
primitive.ready, preferviewer.camera.flyToBoundingSphere(primitive._boundingSpheres[0], { duration: 0 })(orviewer.flyTo(primitive)) over hand-tuned offsets if the scenario only requires "the batch is visible".
Updating Per-Instance Attributes
PrimitiveCollection
Nestable container -- scene.primitives is itself a PrimitiveCollection.
Choosing a Vector Data Path
| Need | Use | |
|---|---|---|
| Entity lifecycle, clustering, per-entity styling, time-dynamic values | GeoJsonDataSource in cesiumjs-entities | |
| One large GeoJSON object with low overhead and primitive-level performance | GeoJsonPrimitive in this skill | |
| Tiled vector data, 3D Tiles LOD, metadata styling, feature picking | MVTDataProvider in cesiumjs-3d-tiles | |
| Fully manual high-throughput point/polyline/polygon buffers | BufferPointCollection, BufferPolylineCollection, BufferPolygonCollection |
Buffer Primitive Collections (Experimental, 1.140+)
Use BufferPointCollection, BufferPolylineCollection, and BufferPolygonCollection for very large vector datasets where Entity/DataSource overhead is too high. These APIs were introduced in 1.140 (#13212) and refined through 1.142; they are experimental and use flyweight primitive objects: reuse one BufferPoint, BufferPolyline, or BufferPolygon when adding or iterating thousands of items.
Breaking change (1.141, #13448):BufferPrimitiveCollection.modelMatrix,boundingVolume, andboundingVolumeWCare now readonly -- you may mutatethe object in place, but reassigning the property (collection.modelMatrix = ...)throws. Update the existing matrix/volume instead of swapping in a new one.
1.142 notes:
boundingVolumeis now world-space, not local/model-space. If you provide it manually, include the collectionmodelMatrixtransform yourself.- Providing
boundingVolumeskips automatic recomputation; this helps large animated collections but makes you responsible for keeping the volume valid. blendOptionis supported on all three buffer collections and enables alpha fromBufferPrimitiveMaterial#color;BufferPointCollectionalso honorsoutlineColor.alpha.- Use
BlendOption.OPAQUEonly when every material is fully opaque; useTRANSLUCENTor mixed blending when alpha varies.
In 1.143, BufferPointCollection no longer leaks outlineColor into the fill when outlineWidth is 0. Set the width to 0 to disable outlines; remove transparent-outline workarounds that would otherwise complicate batching.
GeoJsonPrimitive (Experimental, 1.142+)
GeoJsonPrimitive loads GeoJSON directly into buffer primitive collections, bypassing GeoJsonDataSource and the Entity layer. Prefer it for large static or bulk-updated vector datasets. Keep using GeoJsonDataSource when you need Entity conveniences, time-dynamic properties, clustering, or DataSource lifecycle integration.
GeoJsonPrimitive.fromGeoJson(parsedObject) is available when the GeoJSON is already in memory. Source feature IDs are exposed through ids/getId(), and source properties through properties/getProperties().
Built-in Geometry Types (31)
All geometries take shape parameters and a vertexFormat matching the Appearance. Most have a paired *OutlineGeometry. Outlines require a separate Primitive.
Filled + Outline Pattern
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cesiumjs-primitives/SKILL.md
Popularity
- Repository stars
- 44
- Repository forks
- 7
- 7-day trend score
- 19
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/cesiumgs/cesiumjs-skills/cesiumjs-primitives)