Occlusion shader video recording issues

Using the built-in VR/SpatialMapping/Occlusion shader renders the mesh black when using the built-in video recorder. It looks and the occlusion works just fine within the application.
Similar to this post Occlusion shaders rendering black in video recordings, the difference is that I am using URP as recommended

Unity Editor version: 2022.3.7f1
ML2 OS version: v1.4.0-dev1
MLSDK version: v1.4.0-dev1
Host OS: Windows

Let's fix it MagicLeap <3

Hi @petrebasura,

Welcome to the Magic Leap 2 Developer Forums. We are so grateful to have you here engaging with us.

Thank you for reaching out regarding this issue. Thank you for pointing to a similar issue from before as well as it is helpful for issue tracking.

I have created a bug ticket for this issue and I will reach out to our team to see if there is a quick workaround for this issue.



Hi @etucker
Thanks for your reply.
Do you have any update on this issue? Recording is the only way of communicating our work to stakeholders, we need to fix this as soon as possible.
Thank you

Hi @petrebasura,

Apologies for the inconvenience that this issue has caused. We are working on trying to find a workaround or fix for you as soon as possible. We cannot provide a concrete timeline for this though. I'll be sure to have more eyes on this issue as well.



Thanks @etucker
Is this confirmed to be a bug with the current SDK?

Hi @petrebasura
A workaround I have found when recording videos on the ML is to use a transparent shader on the mesh material instead of the occlusion material. You lose the occlusion of course, so it won't work if that's what you're specifically trying to capture. But at least you get something without the large black mesh in the background.

Thanks for the advice @elliot but I need the occlusion to occlude the virtual in my experience.

The occlusion shader that you're using is a Unity shader? Is it URP?

It is possible to create a custom occlusion shader that will not have this issue. While we are working to provide a shader that does not cause this issue to occur while recording, we recommend creating an opaque shader that writes to the depth buffer as usual, writes black to the color buffer, and writes 0 for the alpha in the meantime.

Let me know if you have any further questions.



Hi @etucker,
As initially described in the post, yes -- I'm using Unity 2022.3.7f1 with URP.
The shader I'm using is the built-in and told to be use by Unity in their tutorial of Magic Leap 2

A transparent material does not solve this bug. Unfortunately at the current state the Magic Leap 2 recording does not work for occlusion feature -- one of the most important features.
Please, keep us informed if there is any solution.

@kbabilinski shared with me the solution to this problem: adding the 'segmented dimmer' render feature to the URP settings
For this, follow the following: Segmented dimming - Unity Learn

Now I can record properly without the occlusion being solid black.
Thanks for the support.