Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
59a543e
Instancing draw command fixes, refactoring model node transforms
ggetz Apr 25, 2025
7c5d96c
Cleanup
ggetz Apr 25, 2025
e8a3812
Cleanup
ggetz Apr 25, 2025
50b337d
merge model instancing v2 updates
lukemckinstry Apr 28, 2025
1314e73
cleanup
lukemckinstry Apr 28, 2025
c7a1c92
docs updates
lukemckinstry Apr 30, 2025
75ccbeb
ModelInstance specs
lukemckinstry Apr 30, 2025
2f8d5a5
add PipelineStage tests
lukemckinstry Apr 30, 2025
d7752f4
add update stage tests to pipeline stage test for model instancing
lukemckinstry Apr 30, 2025
f318f07
wip doc notes
lukemckinstry May 1, 2025
298ed96
shader fixes for normals and instance transforms
lukemckinstry May 2, 2025
95d3754
fixes to model scale
lukemckinstry May 2, 2025
17d85b6
add scaling for runtime instanced models - centered at earth origin
lukemckinstry May 5, 2025
8590281
fix scaling
lukemckinstry May 6, 2025
ede4fe1
docs cleanup runtime model instancing pipeline stage
lukemckinstry May 6, 2025
30403aa
fix runtime model instancing pipeline stage spec
lukemckinstry May 6, 2025
7f5cc0b
api design for model instance collection
lukemckinstry May 7, 2025
e957cf0
model collection updates
lukemckinstry May 8, 2025
00b4710
sandcastle cleanup
lukemckinstry May 8, 2025
ede0483
document instance collection in model class
lukemckinstry May 8, 2025
2601d09
Refine and add examples to inline doc
ggetz May 29, 2025
cbedce9
add wind turbines on terrain sandcastle
lukemckinstry Jun 6, 2025
3ae1ac3
use async await syntax in tests
lukemckinstry Jul 18, 2025
6a4a286
pipeline stage test updates
lukemckinstry Jul 18, 2025
e5b8c84
test fixes
lukemckinstry Jul 18, 2025
b925bdf
test that instances array updates for scale as well as translate tran…
lukemckinstry Jul 21, 2025
8191135
remove spy and tohavebeencalled checks from modelinstance tests
lukemckinstry Jul 21, 2025
a1e5031
documentation updates from model scene graph refactor
lukemckinstry Jul 21, 2025
c2b5144
Fix ModelInstanceCollection.js remove
rudacs Jul 16, 2025
9fb8bb1
Update ModelInstanceCollection.js remove
rudacs Jul 16, 2025
a7386b3
Fix PickingPipelineStage.js pick instances
rudacs Jul 16, 2025
e82f194
Update CONTRIBUTORS.md
rudacs Jul 16, 2025
7868bd6
Exposing the ModelInstance transform property
rudacs Jul 17, 2025
17a6e97
Adjustment in PickingPipelineStage to pass the pickId to the ModelIns…
rudacs Jul 17, 2025
74616b0
Update ModelInstanceCollection.js returns type
Jul 18, 2025
31ff654
Update PickingPipelineStage.js to work in glTF and i3dm
rudacs Jul 21, 2025
084f098
Update PickingPipelineStage.js checking if the index exists
rudacs Jul 21, 2025
b039472
fix instance collection tests
lukemckinstry Jul 22, 2025
3ed0305
update docs for command model matrix and bounding sphere
lukemckinstry Jul 22, 2025
736c752
update inline docs for model scene graph refactor
lukemckinstry Jul 23, 2025
c954e9f
more cleanup from scene graph refactor
lukemckinstry Jul 23, 2025
58d9416
add back update draw command bounding sphere when model matrix changes
lukemckinstry Jul 24, 2025
4b9736e
change name of run node transform dirty param in spec
lukemckinstry Jul 24, 2025
4765fd1
modify spec helpers
lukemckinstry Jul 24, 2025
7e8ffdd
fix picking spec sample data
lukemckinstry Jul 24, 2025
e224c2b
prettier
lukemckinstry Jul 24, 2025
d509f6b
ts doc fix
lukemckinstry Jul 25, 2025
ae14daa
include js extension for ECMAscript module imports
lukemckinstry Jul 25, 2025
5e1a164
use js ext on module import
lukemckinstry Jul 25, 2025
87a8c81
scale by instance
lukemckinstry Jul 25, 2025
9feb546
cleanup code
lukemckinstry Jul 30, 2025
a7322f2
update model instance tests for dynamic scaling
lukemckinstry Jul 30, 2025
7dde3f0
sandcastle fixes
lukemckinstry Jul 30, 2025
f1a23e2
scale down and simplify windturbine gltf
lukemckinstry Aug 4, 2025
b152f3e
move nodesByName to scene graph
lukemckinstry Aug 4, 2025
69c03a4
make scene graph traversal a private member function
lukemckinstry Aug 4, 2025
da38138
simplify transforms in sandcastle
lukemckinstry Aug 4, 2025
30b465e
remove earth centered todo
lukemckinstry Aug 4, 2025
1f08d9f
runtime error for runtime instancing on instanced model
lukemckinstry Aug 4, 2025
0ec82bc
set up runtime instances when transforms passed to model options
lukemckinstry Aug 5, 2025
4040db5
document scene graph attributes
lukemckinstry Aug 5, 2025
4381c3a
runtime error when trying to add instance to model with ext mesh gpu …
lukemckinstry Aug 5, 2025
4debff8
move ext mesh gpu instancing check
lukemckinstry Aug 5, 2025
29f6f5d
spec fixes
lukemckinstry Aug 5, 2025
75f606f
update changelog
lukemckinstry Aug 5, 2025
a5aa6e5
bug fix turn off dirty flag in update stage
lukemckinstry Aug 5, 2025
063dbd0
skip update stage if min pixel size not set
lukemckinstry Aug 5, 2025
2af7371
update test
lukemckinstry Aug 18, 2025
e611a7b
prettier
lukemckinstry Aug 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Apps/SampleData/models/wind_turbine.glb
Binary file not shown.
634 changes: 634 additions & 0 deletions Apps/Sandcastle/gallery/3D Model Instancing Terrain.html

Large diffs are not rendered by default.

108 changes: 108 additions & 0 deletions Apps/Sandcastle/gallery/3D Model Instancing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"
/>
<meta name="description" content="Create 3D models using glTF." />
<meta name="cesium-sandcastle-labels" content="Tutorials,Showcases" />
<title>Cesium Demo</title>
<script type="text/javascript" src="../Sandcastle-header.js"></script>
<script
type="text/javascript"
src="../../../Build/CesiumUnminified/Cesium.js"
nomodule
></script>
<script type="module" src="../load-cesium-es6.js"></script>
</head>
<body class="sandcastle-loading" data-sandcastle-bucket="bucket-requirejs.html">
<style>
@import url(../templates/bucket.css);
</style>
<div id="cesiumContainer" class="fullSize"></div>
<div id="loadingOverlay"><h1>Loading...</h1></div>
<div id="toolbar"></div>
<script id="cesium_sandcastle_script">
window.startup = async function (Cesium) {
"use strict";
//Sandcastle_Begin
const viewer = new Cesium.Viewer("cesiumContainer");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukemckinstry Once the public API is where you'd like it, a reminder to clean up the Sandcastle example.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apps/Sandcastle/gallery/3D Model Instancing Terrain.html is the sandcastle I think is best to release. This has a new wind turbine glb added to the SampleData folder. I believe the CC license makes using it ok #12588 (comment)


let model;
try {
model = await Cesium.Model.fromGltfAsync({
url: "../../SampleData/models/GroundVehicle/GroundVehicle.glb",
minimumPixelSize: 64,
});
viewer.scene.primitives.add(model);
} catch (error) {
console.log(`Failed to load model. ${error}`);
}

const lng = -75.1652;
const lat = 39.9526;

let position;

let instanceTransform;
for (let i = 0; i < 10; i++) {
position = Cesium.Cartesian3.fromDegrees(
lng + i * Math.random() * 0.0001,
lat + i * 0.0001,
);
instanceTransform = new Cesium.Transforms.eastNorthUpToFixedFrame(position);
model.instances.add(instanceTransform);
}

viewer.scene.camera.setView({
destination: new Cesium.Cartesian3(
1253512.5232461668,
-4732922.214567729,
4074115.474546098,
),
orientation: new Cesium.HeadingPitchRoll(
2.205737333179613,
-0.7255022564055849,
6.283181225638178,
),
});

let instance;
let rotation = new Cesium.Matrix3();
let newTransform;
// modify the instance transform by supplying a new rotations after a delay
setTimeout(() => {
for (let i = 0; i < model.instances.length; i++) {
instance = model.instances.get(i);
rotation = Cesium.Matrix4.getRotation(instance.transform, rotation);
newTransform = Cesium.clone(instance.transform);

const angleDegrees = Math.random() * 180;
const angleRadians = Cesium.Math.toRadians(angleDegrees);
const rotationZ = Cesium.Matrix3.fromRotationZ(angleRadians);
const newRotation = Cesium.Matrix3.multiply(
rotationZ,
rotation,
new Cesium.Matrix3(),
);
newTransform = Cesium.clone(instance.transform);
Cesium.Matrix4.setRotation(newTransform, newRotation, newTransform);
instance.transform = newTransform;
}
}, "6000");
//Sandcastle_End
};
if (typeof Cesium !== "undefined") {
window.startupCalled = true;
window.startup(Cesium).catch((error) => {
"use strict";
console.error(error);
});
Sandcastle.finishedLoading();
}
</script>
</body>
</html>
18 changes: 10 additions & 8 deletions Apps/Sandcastle/gallery/development/3D Models Node Explorer.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,16 @@
camera.lookAt(center, new Cesium.HeadingPitchRange(heading, pitch, r * 2.0));

// enumerate nodes and add options
const options = Object.keys(model._nodesByName).map(function (nodeName) {
return {
text: nodeName,
onselect: function () {
viewModel.nodeName = nodeName;
},
};
});
const options = Object.keys(model.sceneGraph._nodesByName).map(
function (nodeName) {
return {
text: nodeName,
onselect: function () {
viewModel.nodeName = nodeName;
},
};
},
);
options[0].onselect();
Sandcastle.addToolbarMenu(options);

Expand Down
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#### Additions :tada:

- Added support for the [EXT_mesh_primitive_restart](https://github.com/KhronosGroup/glTF/pull/2478) glTF extension. [#12764](https://github.com/CesiumGS/cesium/issues/12764)
- Adds support for instancing a model at runtime via `ModelInstance` and `ModelInstanceCollection` classes. [#12588](https://github.com/CesiumGS/cesium/pull/12588)

## 1.132 - 2025-08-01

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [CandyACE](https://github.com/CandyACE)
- [EARTHBRAIN, Ltd.](https://www.earthbrain.com/en/)
- [Gregory Diehl](https://github.com/gdiehleb)
- [Geoex Tecnologias](https://geoextecnologias.com)
- [Rudá Cunha](https://github.com/rudacs)

## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf)

Expand Down
Loading