Camera stacking behind the main ML cam

Give us as much detail as possible regarding the issue you're experiencing.

Unity Editor version: 2022.2.14
ML2 OS version: 1.2.0 dev
MLSDK version: 1.5
Host OS: (Windows)

Hello, I am trying to create a setup where I have 2 cameras stacked. The front camera is the main ML XR Rig prefab and then another camera is rendered underneath that camera using a lower depth priority setting.

I've noticed when doing the above the Magic Leap Camera script on the XR Rig hard sets the Background Type/CameraClearFlag to SolidColor which makes sense in most cases but as I want to have this camera stacked on top of another camera a hard set value is not useful as I need it to be Uninitialized (flag: Nothing) so to pass through the rendering of the camera below.

After some playing with the code, I managed to override the Magic Leap Camera script behavior in Unity by changing the DEFAULT_CLEAR_FLAG variable to CameraClearFlag.Nothing and I've achieved the desired behavior of cameras stacking within the Unity Editor, but when I tested a build it seems as though the value is overridden by the runtime SDK regardless of my code modifications (this used to be the same issue for near-clipping values on older SDK versions).

Is it possible to set the main XR Rig prefab camera setting the Background Type to Uninitialised (CameraClearFlag.Nothing in API code) and stop the SDK from overriding my intended behavior? The camera layer underneath will have the flag/type SolidColor to be clear and will be used as a camera that flys along a path for a visual effect that is separate from the AR-tracked camera behavior.

1 Like

@stuart_spencer Can you include screenshots of your Scene? Specifically, the values you're trying to preserve?

1 Like

Sure, I have highlighted the value. If set at this value it is overridden with Solid Color.

1 Like

Here is the lower-layer camera settings with a priority that makes it render behind the camera above when working in Unity only.

1 Like

And a screenshot of CameraDepth?

1 Like

Sorry getting my words mixed up, CameraDepth is the Background Type which is set via the script using this Camera api. Unity - Scripting API: CameraClearFlags

In the first case above the Uninitialised value is equal to the "Nothing" clear flag from the link above.

Thanks

1 Like

To make it easier for me to understand, can you edit your original question with the correct phrasing?

1 Like

Gave it a tidy up! Let me know if you have anymore questions?

1 Like