Occlusion based on the scanned map?

Hi, I implemented the occlusion algorithm provided on the official website, but it seems like the device is detecting and creating meshes in real time.
Q1. I'm wondering if ML2 supports the occlusion that is based on the existing map and meshes.

Q2. Also, from the documentation, it says the detection range is within 10 meters, which means that occlusion will not work beyond 10 meters. That makes me wonder what happens If I have a virtual object that is supposed to be occluded 10 meters away.

Q3. This also makes me wonder, within what range/extent, ML2 renders objects? (This is not related to occlusion anymore) For example, if there is a virtual ball placed 20 meters in front of you, will ML2 even render this ball? or the distance is already too far from you so it will not be rendered.

Thank you~

Hi @ineedhelpty,

At the moment the data within spaces is not exposed to developers. We hear you on this issue and are always trying to improve our experiences.

While the detection distance is ten meters, it does not directly mean that the occlusion will not work beyond ten meters. It can detect a wall, object, etc. and store that data, meaning that you don't have to be within the detection range in order for it to function. But initial detection of a subject must be within ten meters of the headset.

The Magic Leap 2 headset will render objects based on the Far Clipping Plane set in Unity.



@ineedhelpty Depending on how much the feature moves around one option might be to save the per session mesh to disk against a Spatial Anchor and load it at runtime. Downside is you will lose out on the algorithm updating it in real time but if the goal is to "scan and bake" the environment to create an occlusion mesh that is one way to approach it using your map.

@mrushton Thanks. The goal is to "scan and bake" the environement. I need to have the occlusion mesh ready when I immediately start the session. I'm wondering if Magic Leap 2 currently supports this function? What should I do if there is no such function?

@etucker @mrushton Hi, I think this message has been missed. do you mind looking into this question above?

Hi @ineedhelpty, unfortunately I don't have a sample, but have you tried to save the per session mesh to disk against a Spatial Anchor and load it at runtime, per Mark's suggestion? Thank you.

@kdowney Hi Thank you for the reply. Can you clarify more on how to save the per-session mess to dish against a Spatial Anchor and load it at runtime? I don't know what this means. Is there any documentation about this? I can't find any useful information on the official website. Do you mind showing me how to do it? Thank you.

@etucker @mrushton @kdowney
Hello, I have a follow-up question regarding this problem. This article from Magic Leap's website (Spatial Mapping for Magic Leap 2) mentions that the dense mesh data of the scanned space (The space scanned using the ML2's Spaces application) can help enable occlusion. If this is supported, I do not understand why ML2 only supports the real-time occlusion instead of the occlusion based on the scanned local space stored on the device. Real-time occlusion is not too practically helpful for industry applications because we need virtual objects to be immediately occluded as soon as we turn on the applications instead of waiting until walls are detected first.

Thank you for your time.

Hi @ineedhelpty,

Thank you for your feedback. I have shared this information with our voice of customer team. Since we do not offer this feature in our SDK you can ask the user to scan the space before starting the experience or you could save the mesh to the Magic Leap using Spatial Anchors. Here is the Spatial Anchors Github project for additional information regarding creating content that persists.



Hi, thank you for the reply earlier.

I understand how to load a virtual object using spatial anchors. However, loading a mesh and loading a virtual object is different. To load a virtual object, the center of the virtual object will match the spatial anchor's location.
The problem is that we need to find a feature point of the mesh to match the spatial anchor location so that the mesh will overlay on top of the structures properly. How can I access the mesh generated by the real-time occlusion and pick this point?

@etucker @kdowney @mrushton Sorry that I forgot to mention people in my previous comment.

Hi @ineedhelpty,

Just wanted to let you know that this issue is still in the works on our end. We are looking to get you a solution in the near future.