Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cesium3DTileset modelMatrix reset error #12002

Open
wonphll536 opened this issue May 28, 2024 · 2 comments
Open

Cesium3DTileset modelMatrix reset error #12002

wonphll536 opened this issue May 28, 2024 · 2 comments

Comments

@javagl
Copy link
Contributor

javagl commented May 28, 2024

(Edit: This was also posted in the forum at https://community.cesium.com/t/cesium3d-tileset-model-matrix-reset-error/32477 )


  • When the transform is modified, then this will cause a call to Cesium3DTile.updateTransform, which updates the bounding volume of the tile by calling createBoundingVolume
  • When the tile defines a region in its bounding volume header, it will create the tile bounding volume by calling createRegion
    • Important: It will pass in the current bounding volume of the tile as the result parameter, to be filled with the data from this region
  • The createRegion function tries to fill the result parameter, assuming that it is a TileBoundingRegion
  • But... when the transform changed, then the createRegion will not return a TileBoundingRegion. Instead, it will return a TileOrientedBoundingBox, by calling createBoxFromTransformedRegion

So to summarize: Changing the transform (by setting the modelMatrix) will convert all TileBoundingRegion into TileOrientedBoundingBox instances. Changing the transform again will trigger the update process, which find the region in the tile, and then assumes that the tile bounding volume is a TileBoundingRegion, even though it was previously changed to be a TileOrientedBoundingBox.

There could be some ... "pragmatic" ... fixes for this, involving some if (result instanceof TileOrientedBoundingBox) doNotTryToFillItWithRegionData(), but the details are to be sorted out...

@jjhembd
Copy link
Contributor

jjhembd commented Jun 5, 2024

This could be a one-line fix in the createRegion function in Cesium3DTile. We already check if the transform has been changed, and if so, return a TileOrientedBoundingBox instead of a TileBoundingRegion.

So this:

  if (
    !Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8)
  ) {
    return createBoxFromTransformedRegion(

could become this:

  if (
    !Matrix4.equalsEpsilon(transform, initialTransform, CesiumMath.EPSILON8) ||
    result instanceof TileOrientedBoundingBox
  ) {
    return createBoxFromTransformedRegion(
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment