-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
User-defined clipping planes #5765
Comments
I recently added cross-section support to a glTF model for a proof-of-concept for a customer. It can be done external to Cesium using some existing (but undocumented) hooks. Simple but effective: |
Contributions to core Cesium welcome. 😄 |
Haha, well, I wasn't really sure we'd want it in core Cesium. At least, building stuff like this into the Model class seemed questionable. It's already huge! Maybe more like a plugin (or at least separate class) that bolts this feature on the way the code above does? |
I suspect this will be a property (or array of clip planes) applied to a model or tileset that then modifies the shaders. The implementation can probably be added pretty cleanly and be in mostly a separate file so we can add it elsewhere if/when needed. Also, if there are other terria features that you are not sure if Cesium would want, please send me a list. 😀 |
!!!! |
Initial Effort Roadmap
Later
Other ideas
CC @lilleyse |
Thanks for putting this together! @lilleyse could you create a branch
May also need to lay down z first, but that may not be worth it.
Also generate optimized shaders - only tiles/draw-commands with bounding volumes intersecting any clipping plane need to do the check.
Move this from Other ideas to Later. We should certainty do this - just like a |
|
Also, please add a blog post to the roadmap - the culling optimization is interesting and I don't think there is a ton of information in general on implementing clipping planes. |
FYI: while CV and 2D support is coming, enabling clipping planes on the Globe while in CV has effect, and it's not what's desired. When clipping the globe, it would be nice if the clipped area could be filled with a color (with alpha, or a whole material) to act as a backdrop. For example, in the sandcastle showcase this would mean the Cesium Man is rendered atop a solid color (e.g. black) hole rather than the stars/skybox/(fog/horizon). Otherwise, if the planes themselves could be "shaded" and clipped to the terrain/geometry, that would be ideal. |
Thanks for the 2D/Columbus report @nmschulte. For the backdrop, you can hide the skyBox and set the scene backgroundColor to achieve that effect. I'm not sure what you mean by having the planes themselves be "shaded", if you could provide an image similar to what you mean that would be helpful. |
After playing with this some more I can clarify now. I'm focusing on clipping the globe, for subterranean concepts, but the idea should generalize. What I had in mind is this: -- Bigger picture: I want to provide a better back-drop for entities/primitives/meshes placed inside the clipped region of the globe. If this was done with actual geometry/mesh, this could improve the current default camera behavior too (as it is, it seems one can "pick" a point "inside" the globe as the camera manipulation ref. pt., see the attached animations). I also want to show the original clipped surface with a different shading (material/shader), much like this "other idea":
More than six planes may be handy for more complex geometry carving; the ability to specify an arbitrary geometry would be amazing, but that might be out of scope given the tech in focus here. Last, if it matters, the ability to clip entities/primitives would be neat. I don't have a concrete grasp on the technical limitations though; I haven't yet dug into how this is implemented. |
Thanks for the clarifications @nmschulte and the use cases!
In the current implementation, we color the edge of the mesh that is being clipping with
We've done a little with clipping volumes, specifically cubes, that we hope to bring to production soon.
Currently, you can clip model entities, and as far as I'm aware, it could be added it to other entities by adding the clipping shader modifications and hook for the other primitives. |
OK to close this or is there more in #5765 (comment)? Perhaps clipping cube/volume should be a separate issue? |
Opened #6696 for clipping volume and closing. @lilleyse I didn't see anything else concrete in #5765 (comment) to also open an issue for, let me know if you see anything else that should. |
For example, to reveal the interior of a CAD model in a 3D tileset.
Support up to 6 planes so a user can create a cube.
The classic implementation of this is a fragment shader with a 1D alpha texture (or maybe just
discard
).Probably expose this for 3D tilesets and glTF models. We can add it to primitives, terrain, etc. if those cases come up.
The text was updated successfully, but these errors were encountered: