Be able to create a "Mask" with objects
Hello,
Is there a way to hide objects (= not visible by the user) but still creating a "mask" regarding the other objects of the scene. Objects could be glb or xkt.
Thanks for your help
Hi @tgranie, What specifically do you mean by a "mask"? If a front object is to be hidden, how would a "masked" object behind it look like?
Hi @MichalDybizbanskiCreoox
Ok you're right it was not clear enough. Let me explain with this simple schema :
- The red square is an object the user see
- The gray square is an object the user does not see but in front of the red square
- The gray square "mask" the red square because it exists even if not visible
So I was wondering if there is a way to simulate this in xeokit, objects could be xkt or glb.
Thanks for your help,
Thibault
This sounds like the "depth-pre-pass" technique, where the renderer avoids drawing anything that's obscured by something else.
It would involve refactoring the renderer to
- draw pixel depths to a depth buffer, then
- draw pixel colors only when the pixel has a depth that is not greater than the value already written for that pixel in the depth buffer
It's a technique that can speed up drawing for high-detail scenes, so possibly worth having.
Hi @tgranie , By "gray square "mask" the red square" should we understand that parts of the red square that overlap with the gray square are not being rendered? In the 3D context that would mean that an invisible "masking" object effectively creates a "hole" through the scene, so the only thing that's "visible" in its place is the canvas background. If that would indeed be what "masking" was supposed to work like, then the xeokit SDK doesn't currently support if out of the box, but we could consider adding this as a new feature (with possible edge case limitations related to picking). Best, Michał
@MichalDybizbanskiCreoox To answer your question, Yes