Closed joseph-kaile closed 3 months ago
TRIANGLE
and TRIANGLE_STRIP
, but the latter via the else
case. It does not cover TRIANGLE_FAN
. The LINE...
cases should probably be ignored.indices
are assumed to be present at https://github.com/CesiumGS/cesium-native/pull/777/files#diff-6fc212582e9b885efd06f87042cb7db30c537e565c2369d606ad8d968c83178bR264 - the geometry may be non-indexedEXT_mesh_gpu_instancing
will come up sooner or later, but may not be in scope yet...Opening this up for review (non-draft).
All previous comments should have been addressed and any known major functionality is done.
I may add some more commits from self-review later on, but it's ready for some eyes on it.
Opening this up for review (non-draft).
All previous comments should have been addressed and any known major functionality is done.
I may add some more commits from self-review later on, but it's ready for some eyes on it.
Hello team,
I (and ChatGPT) noticed an edge case not handled. In the ray-OBB code, halfAxes could be singular. See the comment in the OBB constructor. I would recommend rewriting it to not use halfAxis.
Thanks
Hi @joseph-kaile, good to hear from you, hope you're doing well! Thanks for the note about the edge case. Are you referring to IntersectionTests::rayOBBParametric
specifically?
Hi @joseph-kaile, good to hear from you, hope you're doing well! Thanks for the note about the edge case. Are you referring to
IntersectionTests::rayOBBParametric
specifically?
I’m doing well, thanks. Yes, I’m referring to that function.
I found this out recently after intersecting the large root tiles of CWT.
I found this out recently after intersecting the large root tiles of CWT.
Ok, cool. It's not obvious to me why the CWT root tile OBB half axes would be singular. But we should probably handle that possibility in the intersect function in any case.
The question about the handling of (near) singular matrices is essentially leaked through from an old, unaddressed TODO
. My understanding is that this is undefined behavior and a crash waiting to happen.
But... one could argue whether this should be addressed in this PR or ... more holistically. Yes, the glm::inverse
function brutally divides by (potentially) zero. The fact that theOrientedBoundingBox
constructor is declared noexcept
therefore raises a bunch of questions, somewhat related to https://github.com/CesiumGS/cesium-native/issues/348 and the comment in the glm docs that I already linked to. Still, the code in this PR just relied on existing functionality. Nobody can expect someone who uses the OrientedBoundingBox
to look into the constructor code and see whether there might be an open TODO
(of which nobody knows how to resolve it).
(But of course, all that is not on me to decide...)
Still, the code in this PR just relied on existing functionality. Nobody can expect someone who uses the OrientedBoundingBox to look into the constructor code and see whether there might be an open TODO (of which nobody knows how to resolve it).
I'm thinking we should make this a separate issue, and not handle it for this PR.
I do have opinions of course (like letting the OBB constructor code throw), but this feels like something to be discussed outside of ray intersection tests.
@kring, ready for another look. All comments have been resolved or commented on.
@kring Review changes committed. Ready again for another look.
@kring Ready for one more pass!
Looks good, thanks! I'll merge as soon as CI passes.
Added two new utility functions,
rayTriangle
andintersectRayGltfModel
. They have unit tests to verify their correctness.This PR can really be thought of as two distinct efforts: