Skip to content

Conversation

@jjhembd
Copy link
Contributor

@jjhembd jjhembd commented Mar 14, 2025

Description

Recent updates to the 3D Tiles extension 3DTiles_bounding_volume_cylinder included a change in the way the shape bounds were defined. Instead of an oriented bounding box, the extension now defines the radius, angle, and height bounds, along with an optional transform specified as a rotation and translation.

This PR updates the test datasets to follow the new spec, and reworks the getCylinderShape helper in Cesium3DTilesVoxelProvider to read the new values.

Other changes include:

  • Cleaned up references to cylinder bounds to consistently assume the (radius, angle, height) coordinate order everywhere. This fixes the naming and functionality of the Bounds and Clipping editors in VoxelInspector.
  • Handled cylinder voxels in the updateVerticalExaggeration helper in VoxelPrimitive. This enables vertical exaggeration of cylinders, and also passes dynamic updates to the modelMatrix through to primitive._exaggeratedModelMatrix so that they are accounted for in the rendering.

Issue number and link

Fixes #12275.
Fixes #12276.
Fixes #12521.

Testing plan

  1. Run VoxelPrimitiveSpec and Cesium3DTilesVoxelProviderSpec locally.
  2. Load the testing Sandcastle from #12275 and verify that the voxel expands as expected.
  3. Test the "Voxel Inspector" => "Transform", "Bounds", and "Clipping" editors in the Voxels and Voxels in 3D Tiles Sandcastles, focusing on the cylindrical examples.

Author checklist

  • I have submitted a Contributor License Agreement
  • I have added my name to CONTRIBUTORS.md
  • I have updated CHANGES.md with a short summary of my change
  • I have added or updated unit tests to ensure consistent code coverage
  • I have updated the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code

@github-actions
Copy link

Thank you for the pull request, @jjhembd!

✅ We can confirm we have a CLA on file for you.


/**
* Defines the minimum bounds of the shape. Corresponds to minimum radius, height, angle.
* Defines the minimum bounds of the shape. Corresponds to minimum radius, angle. height.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* Defines the minimum bounds of the shape. Corresponds to minimum radius, angle. height.
* Defines the minimum bounds of the shape. Corresponds to minimum radius, angle, and height.

I assume?

};
}

function getCylinderShape(cylinder, tileTransform) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume there are no spec updates since everything now "just works" with the new sample data correct?

Should we add a unit test for the exaggeration as well to prevent any future regressions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, since we updated the sample data at the same time, the existing specs capture the behavior of the new data format.

I added a unit test for vertical exaggeration of cylinder voxels, which didn't work before this PR.

@ggetz
Copy link
Contributor

ggetz commented Mar 17, 2025

Thanks @jjhembd! Some small comments from me on the code.

The testing sandcastle now works as expected for me. 👍

However, I noticed some strange behavior when adjusting the max angle in the inspector (this is again the provided testing Sandcastle, I just didn't hit the "Make bigger" button first). There appears to be some clipping on the right side of the frame:

image

I'm also seeing some unexpected behavior when adjusting the transforms in the inspector in both the "Voxels" and "Voxels in 3D Tiles" sandcastles. The translation doesn't seem to have any effect, and any scale adjustments end up flattening the shape completely:

image

@jjhembd
Copy link
Contributor Author

jjhembd commented Mar 17, 2025

Thanks @ggetz! I addressed your code comments. For your last two observations:

  1. Strange behavior when adjusting the max angle: I had a little trouble reproducing it, but it sounds like another manifestation of an existing issue: Voxel artifacts when camera direction is parallel to clipping angle #11004. Does that issue capture what you're seeing?
  2. Unexpected behavior of the transforms in Voxel Inspector: This is caused by the Voxel Inspector overwriting the model matrix, after we already used the model matrix to scale the voxel to the size of the Earth. See Cylindrical voxels aren't affected by vertical exaggeration #12276 (comment). I fixed the Sandcastles by moving the scaling to the VoxelProvider.prototype.globalTransform, which is where it would normally appear in real-world datasets. Let me know if this resolves it on your end.

@ggetz
Copy link
Contributor

ggetz commented Mar 18, 2025

  1. Good catch. Yes, what I saw looks exactly like Voxel artifacts when camera direction is parallel to clipping angle #11004. That sounds out of scope for this PR.
  2. Ah, makes sense. The examples are now working like a charm!

@ggetz
Copy link
Contributor

ggetz commented Mar 18, 2025

All looks fantastic. Thanks @jjhembd!

@ggetz ggetz added this pull request to the merge queue Mar 18, 2025
Merged via the queue into main with commit 466f780 Mar 18, 2025
9 checks passed
@ggetz ggetz deleted the voxel-cylinder-fix branch March 18, 2025 13:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants