-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Fix clipping plane issue with child tiles with transforms #6616
Conversation
@ggetz, thanks for the pull request! Maintainers, we have a signed CLA from @ggetz, so you can review this at any time. I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
It looks like the root tile is no longer getting gradually clipped in the demo. |
Source/Scene/Model.js
Outdated
@@ -3009,7 +3012,8 @@ define([ | |||
if (!defined(clippingPlanes)) { | |||
return Matrix4.IDENTITY; | |||
} | |||
return Matrix4.multiply(model._modelViewMatrix, clippingPlanes.modelMatrix, scratchClippingPlaneMatrix); | |||
var clippingPlanesModelMatrix = Matrix4.multiply(model._clippingPlaneModelMatrix, clippingPlanes.modelMatrix, scratchClippingPlaneMatrix); |
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.
modelViewMatrix
already incorporates computedTransform
, so this might be double applying it and leading to unexpected results.
@lilleyse Tweaked to use the proper transforms for i3dm and b3dm. b3dm needs the inverse of the relative transform from the root tile. |
Still working on a fix for the case here: #6600 (comment) |
I built off the solution here, so I'd say replaced by #7304. |
@ggetz please close if you are OK with that. |
Fixes #6600
This is intentional - The tile intersection calculations were correct (turned on
debugBoundingVolume
in the below example to illustrate). The clipping planes'modelMatrix
is relative to the root tile, so we should use that to determine the planes' location in world space.The problem was that each tile's model shared a reference to the same clippingPlaneCollection (to save memory), and therefore couldn't account for additional child transforms. Added a private additional matrix to model which each tile sets individually so they can continue to share the reference to the clippingPlaneCollection.
Sandcastle example