Bounding volume issues until tileset.boundingSphere is accessed
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 15.8k
- Forks
- 3.9k
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 34
Description
Start with the following Sandcastle. It will create a 3D Tiles tileset floating high above the earth.
It also creates a debug bounding volume around the tileset. However, the debug bounding volume does not show up if you generate it before access tileset.boundingSphere. I have no idea why but it looks like accessing tileset.BoundingSphere might actually compute some data.
To see this, modify the code to uncomment out //const fixDebugVolume = tileset.boundingSphere; and the debug volume will suddenly show up.
const viewer = new Cesium.Viewer("cesiumContainer");
try {
const scene = viewer.scene;
const tileset = await Cesium.Cesium3DTileset.fromIonAssetId(40866);
tileset.modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(
Cesium.Cartesian3.fromDegrees(0, 0)
);
scene.primitives.add(tileset);
//const fixDebugVolume = tileset.boundingSphere;
const tileBv = tileset.root.boundingVolume;
scene.primitives.add(tileBv.createDebugVolume(Cesium.Color.WHITE));
scene.camera.flyToBoundingSphere(tileset.boundingSphere, {
endTransform: Cesium.Matrix4.IDENTITY,
duration: 0,
});
} catch (error) {
console.log(`Error loading tileset: ${error}`);
}
I also realized that leaving the line commented (i.e. broken) and then commenting out the tileset.ModelMatrix = line also fixes it (but the tileset is now in the wrong place) so clearly this has something to do with when the tileset modelMatrix gets applied to the bounding sphere,.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Sandcastle using Cesium.Cesium3DTileset.fromIonAssetId, the tileset modelMatrix, root.boundingVolume, and createDebugVolume. Compare the debug volume behavior before and after accessing tileset.boundingSphere, including when modelMatrix is omitted. Done means the debug bounding volume appears correctly without requiring an unrelated explicit boundingSphere access.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100