-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
base: main
Are you sure you want to change the base?
Conversation
@jjspace Can you take a review pass on this? |
box.center, | ||
transformedRay.origin | ||
); | ||
transformedRay.direction = Cartesian3.clone(ray.direction); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"TODO"? 🤔
packages/engine/Source/Core/Ray.js
Outdated
} | ||
|
||
result.origin = Matrix4.multiplyByPoint(transform, ray.origin, result.origin); | ||
result.direction = Matrix4.multiplyByPoint( |
There was a problem hiding this comment.
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
?
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
Author checklist
CONTRIBUTORS.md
CHANGES.md
with a short summary of my change