MRTK ML Camera - Near Clipping Plane

Unable to set custom near clipping plane.
Something is overwriting the camera near clipping plane on update.
I searched for everything that references the cameras clipping plane - no luck
In previous versions if I would change:
private static readonly float MINIMUM_NEAR_CLIP_METERS of magicLeapCamera and it worked...
The MRTK camera profile doesn't do anything, were not working before.

Unity Editor version:
2022.2.0b8
ML2 OS version:

  • Magic Leap OS - 1.1.0-dev1 [B3E.221020.13-R.039]
    MLSDK version:
    1.1.0-dev1
  • MRTK - 1.0.0-v1
    Host OS: (Windows/MacOS)
    Win

Error messages from logs (syntax-highlighting is supported via Markdown):

1 Like

Thank you for your post @istvan. I'm looking into this now and will report back asap.

1 Like

I noticed that the release note for the XR plugin 7.0.0-pre.1 said that this is being enforced.

Bummer, I couldn't figure out how to trick it into letting me use the clip plane that I want. Makes me want to revert to 7.0.0-exp.6 but not sure how to do that

https://docs.unity3d.com/Packages/com.unity.xr.magicleap@7.0/changelog/CHANGELOG.html?fbclid=IwAR3En3oVT9MGWNSsmxMYn6GqmlJSkCx_Exx2U-KkrpjFDXBkmxOvFZ7bhIk

1 Like

Hi @istvan, In our November release, we updated our Unity Magic Leap XR Plugin dependency to 7.0.0-pre.1. Unity also added enforcement that the camera's near clipping plane will be at least the amount specified by MagicLeap Graphics API, which by default is 0.37m. Please see our Comfort and Content Placement guide for more information. If your near clipping plane is set lower than the default, you will experience issues.

Please let me know if I understood your question correctly and if the above helps.

1 Like

@javier This is expected to be a temporary regression. It's a bug. We'll have a fix to bring it back in a future release.

1 Like

" This can be mitigated by showing a projection of the content onto the near clipping plane whenever content does go behind the clipping plane. " - Comfort and Content Placement .

I would love to see a sample scene of how you've envisioned this to work.

1 Like

@sengelman

This is expected to be a temporary regression. It's a bug. We'll have a fix to bring it back in a future release

Are you saying that the near clipping plane in XR plugin 7.0.0-pre.1 is a bug with 0.37m forced setting support?

Or do you mean that the ability to change the 0.37cm near clipping plane is a bug?

In the first place, does Magic Leap want to be able to change the 0.37m near clipping plane? Or do you want Magic Leap to not be able to change the 0.37m near clipping plane?

We are changing the near clip minimum enforcement logic in a future release. Currently targeting January. Developers have been able to change the near clipping behavior in the past due to a bug in the one of the packages. In the future, the minimum clipping plane enforcement will recommended and not mandatory.

2 Likes

Is this feature public yet, I can change the setting in Unity editor by commenting out lines in the MagicLeapML.cs script. If I build the clipping seems to revert back. Has the update been released yet? Thanks

1 Like

The clipping plane requirement will be fixed in a future version of the com.unity.xr.magicleap package. Keep an eye out for for the update in the package manager.

@kbabilinski want to see if there's an update on the near clip minimum enforcement logic. The enforcement still seems to be there for me, has the behavior been changed in any new release yet?

A prior release allowed developers to bypass the minimum clipping plane in Unity. We have restored the enforcement of the minimum clipping plane to 37cm to ensure that apps can be comfortably used by a wide range of users. We are investigating use cases and techniques to maintain comfort while allowing developers to look at objects more closely.

If you have a specific use case you would like to share, and additional feedback I can pass it along to our voice of customer team.

I am developing for brain surgeons. They definitely need be able to look closer than 0.37cm. Also, if you are used to HoloLens 2 (which they are) you want to see a hand menu - and not have to stretch your arms for that. Please let us developers (and most importantly, our customers) decide what we need.

Having said that - what is the easiest way to disable that? I take full responsibility.

1 Like

We have the same issue with regards to the hand menu @localjoost. We've just created a custom version of the com.magicleap.unitysdk package and commented out the near clip enforcement in MagicLeapCamera.cs line 261.

That was exactly what I had in mind, I even thought about blogging about it, although I probably would not make friends with it. Now you have basically done that for me, thank you for saving me the trouble :wink:

Hm. I have tried this, but it does not seem to work. What am I missing? Tried completely rebuilding the app, removing libraries folder, etc. It does work, that is, in the Editor, but I don't see any effect RUNTIME

Strange, how are you specifying the overriden near clip? Are you using the same profile at runtime as in editor?

Are you on MRTK 2 or 3? We're only on 2, so it could be something specific about 3 that you need to do.

You could try try overriding the the camera near clip value in the MagicLeapCamera.cs LateUpdate function just before it's passed to the MagicLeapXRRenderSettings.

It seems that in the new Magic Leap Unity SDK (version 1.12.0) it is now possible to adjust the near clipping plane. Haven't tried it yet, but this is what it says (among other things) in the changelog of the package I downloaded with the Magic Leap Hub:

  • ...
  • Added the ability to change the nearClipPlane of the Unity Camera with respect to the minimum distance selected in the device's system settings.
  • ...

Version 1.12.0 is not yet available on the scoped registry, but hopefully Magic Leap will soon publish it there too.

I am using MRTK3 indeed

We're also looking into this in the context of having a menu attached to the hand. Setting the near clip on the camera itself is still written over when you play with 1.12, so I'm curious what the intended way to set this value is.