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

3D Tiles pick improvement: Check intersections with tile bounding volumes #11817

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ggetz
Copy link
Contributor

@ggetz ggetz commented Feb 7, 2024

Description

This adjust the tileset pick code such that we are testing intersections with the tile content bounding volumes directly rather than the bounding spheres.

The bounding sphere could be quite large, especially for tileset bounding region volumes, leading to need to check intersections more models directly, leading to poorer performance particularly in tilesets like OSM.

Along with @javagl's suggestions in #11814 (which can go in separately), this should help remedy the drop in performance seen for OSM.

Issue number and link

At least partial addresses #11811.

Testing plan

  • Test OSM performance in Sandcastle by adding:
viewer.scene.debugShowFramesPerSecond = true;
  • Spot check other 3D tilesets (like Google P3DT) to wnsure performance was not negatively affected
  • Test to make sure camera collisions still work with the surface of 3D Tiles

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 update the inline documentation, and included code examples where relevant
  • I have performed a self-review of my code
  • I need to address the remaining TODO in S2 tileset bounding volumes

@ggetz
Copy link
Contributor Author

ggetz commented Feb 7, 2024

@jjspace Can you take a review pass on this?

box.center,
transformedRay.origin
);
transformedRay.direction = Cartesian3.clone(ray.direction);
Copy link
Contributor

Choose a reason for hiding this comment

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

transformedRay.direction = Cartesian3.clone(ray.direction, transformedRay.direction);
to avoid allocation?

BTW: I think the X/Y/Z cases below could go into some

// Implementation based on https://education.siggraph.org/static/HyperGraph/raytrace/rtinter3.htm
if (!updateRange(Cartesian3.UNIT_X, origin.x)) {
return;
}
if (!updateRange(Cartesian3.UNIT_Y, origin.y)) {
return;
}
if (!updateRange(Cartesian3.UNIT_Z, origin.z)) {
return;
}

but I probably overlooked something here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since it's a fairly short repetition, I left it unfolded for better readability.

Copy link
Contributor

@jjspace jjspace left a comment

Choose a reason for hiding this comment

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

I think the code looks alright. Just had 1 optional comment.

That said when running the local or CI version I don't see a noticeable speed up for the OSM buildings Sandcastle. I'm still regularly seeing 5-10 frames when moving or zooming the camera. Is this supposed to resolve that? or is that expected?

@@ -616,6 +616,8 @@ TileBoundingS2Cell.prototype.intersectPlane = function (plane) {
return Intersect.INTERSECTING;
};

// TODO
Copy link
Contributor

Choose a reason for hiding this comment

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

"TODO"? 🤔

}

result.origin = Matrix4.multiplyByPoint(transform, ray.origin, result.origin);
result.direction = Matrix4.multiplyByPoint(
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't that be multiplyByPointAsVector?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants