Skip to content

Be able to create a "Mask" with objects #1849

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

Open
tgranie opened this issue Apr 3, 2025 · 5 comments
Open

Be able to create a "Mask" with objects #1849

tgranie opened this issue Apr 3, 2025 · 5 comments
Labels
question Further information is requested

Comments

@tgranie
Copy link

tgranie commented Apr 3, 2025

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

@tgranie tgranie added the question Further information is requested label Apr 3, 2025
@MichalDybizbanskiCreoox
Copy link
Collaborator

MichalDybizbanskiCreoox commented Apr 4, 2025

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?

@tgranie
Copy link
Author

tgranie commented Apr 7, 2025

Hi @MichalDybizbanskiCreoox

Ok you're right it was not clear enough.
Let me explain with this simple schema :

Image

  • 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

@xeolabs
Copy link
Member

xeolabs commented Apr 7, 2025

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

  1. draw pixel depths to a depth buffer, then
  2. 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.

@MichalDybizbanskiCreoox
Copy link
Collaborator

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ł

@tgranie
Copy link
Author

tgranie commented Apr 7, 2025

@MichalDybizbanskiCreoox To answer your question, Yes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants