Transitioning Between Realities: ML2 Dynamic Dimmer And Unity Setup

Magic Leap 2 Dynamic Dimmer…

In most Virtual Reality devices today, the entire field of view is either completely dedicated to virtual content, where the physical world is not visible at all, or some type of hybrid version called "Mixed Reality," where we have both VR and AR by using passthrough or waveguides technology as found with the Magic Leap 2 devices. Well, today I would like to introduce you to Magic Leap's 2 Dynamic Dimmer, which provides two powerful options for developers:

1. A Global Dimmer, which dims the environment to ensure clear, solid, and vibrant digital content in bright areas. Think of this as a tint applied to the background under all the virtual content, in which you can control its opacity value.

2. A Segmented Dimmer, which allows applications to locally dim just the part of the display with virtual content. This means a subtle tint or border is applied around the edges of 2D/UI content and even 3D content.

Both of these dimming options can be used simultaneously, allowing for a wide range of use cases. For example, you can use the ML2 in bright areas like outdoors or operating rooms, where virtual content could be very hard to see under these conditions. ML2 Dynamic Dimmer solves those use cases by allowing you to control how much light affects virtual content. Pretty cool, huh? Well, let me show you a few tests I ran on the ML2, with the results displayed through the lenses.

ML2 Global And Segmented Dimmer Results (Through The Lens)

I conducted several tests to evaluate the global dimmer features, which included simply using the OS Global Dimmer and building a custom Unity application for the ML2. Below, you can view a few demos in which dimmer changes are demonstrated.

A few things to note from the Magic Leap 2 demos above. The first image uses the global dimmer, allowing you to view only the map area and not the physical world. The second and third demos showcase both global dimmer functionality and the segmented dimmer, where you can observe a slight border or shadow generated by the segmented dimmer mask. Also, please note that all of this is captured through the lens, which can be challenging to convey accurately and may not fully reflect just how impressive this looks with the physical device.

What is required to support Global & Semantic Dimmer In Unity?

To get these features working I really recommend you to look at by step-by-step YouTube video where I go through the entire process of adding Global & Segmented dimming features. If you prefer a checklist type tutorial here’s what you need:

Fig 1.0 - Magic Leap Setup Tool

  • Global Dimmer Unity Setup:

    • Download all the Unity requirements including ML Hub from here

    • Open your Unity Hub, create a new Unity Project with Unity v2022.2.0f1 or greater and select 3D (URP) as your project template

    • Go to package manager > select “Packages: My Asset" and search for “Magic Leap Setup Tool”

    • Import the “Magic Leap Setup Tool” and when it opens be sure to apply all changes until everything is green as shown on Fig 1.0

    • Create a new scene or use the default sample scene, remove the “Main Camera” and “Global Volume” game objects

    • Drag & Drop the “XR Rig” from your Project > Packages > Magic Leap SDK > Runtime > Tools > Runtime into your hierarchy or scene

    • Right click on your Hierarchy > 3D Object > Cube, be sure to place it at position (0,0,1), scale it to (0.25, 0.25, 0.25), and rotate it to (0, 45,0)

    • Add a new empty game object and call it “DimmerController”

    • Download this script to your computer and then place it under a Scripts in Unity

    • Assign the “DimmerController.cs” to your empty game object created previously (very important, this script uses the new input system, make sure you’ve enabled the new input system and also have “Input System” package, if you don’t follow these steps)

    • Connect your ML2 via USB-C to your Mac or PC

    • Deploy your application by going to File > Build Settings, select your “ML2” device from “Run Device” and click on “Build And Run” (if you' encounter any issues with this process then consider watching my ML2 with Unity setup YouTube video)

  • Segmented Dimmer Unity Setup (Part 1)

    • Be sure to follow all the steps under “Global Dimmer Unity Setup”

    • Add a new Layer and call it “SegmentedDimmer”

    • Go to File > Build Settings > Player Settings > Graphics, check which file is listed under “Scriptable Render Pipeline Settings”, we will need to know it for the next step

    • With the URP-* file selected, go to “Renderer List” and click on the first file, see Fig 1.1 as a reference

Fig 1.1 - Renderer List URP file

  • Segmented Dimmer Unity Setup (Part 2)

    • Now with the *-Renderer file selected, click on “Opaque Layer Mask” > uncheck “SegmentedDimmer” layer, repeat the same step for “Transparent Layer Mask”

    • Add a new render feature by clicking on “Add Render Feature” > select “Segmented Dimmer” from the list. Under “Layer Mask” make sure “SegmentedDimmer” is the only layer selected

    • That's it! Now, deploy your application as you did previously, but this time you should notice a border around your "Cube." To apply the segmented dimmer, toggle the bumper on your controller on and off, and use the touchpad by swiping from left to right to adjust the global dimmer.

What's my overall take on Magic Leap 2 Dynamic Dimmer?

Magic Leap 2 - Device Computer Pack, Controller, and Headset

First, I want to ensure transparency to the fullest extent. This video was sponsored, and I'd like to express my gratitude to Magic Leap for their support. At the same time, I'm dedicated to sharing my thoughts on all the XR technology I encounter, whether it's sponsored content or not.

I've had the Magic Leap 2 since its release September 30, 2022, and during AWE 2022, I had the privilege of being one of the first to test it. I remember visiting a special VIP office where I was invited by members of the Magic Leap team. During my time there, I patiently observed the reactions of other tech enthusiasts and business professionals who were also testing the device. All I could see were smiles and a great deal of excitement.

After witnessing these reactions, it was finally my turn to test the device. Up until that point, I had experience with various VR devices (Quest devices, Varjo) and a range of AR glasses, each excelling in its own domain. However, testing the ML2 provided me with a completely different perspective on how the future of Mixed Reality might unfold in the coming years.

Returning to my test experience, I put on the ML2 glasses, and the person assisting me said, "Dilmer, open this experience," through which I could view 2D content and 3D models. Initially, I was impressed—the ML2 looked great, with a larger field of view, significantly improved image quality, and a beautifully bright display. I thought, "Heck yeah, this looks amazing! Good work, guys."

Then, he introduced me to the global dimmer feature, and I was taken aback. I thought, "Try WHAT?!?" Yes, global dimmer. I followed the instructions, and that's when it hit me: "HOLY S... this is amazing." I experimented with various types of virtual content, seamlessly transitioning between AR and VR experiences and vice versa., and it became evident that this was the future of Mixed Reality. Subsequently, he had me explore the Segmented Dimming features, which added even more depth to the experience. Honestly, it was both aesthetically pleasing and practical.

So, do I recommend it? Is this for everyone? The ML2 is an incredible device, but it's not for the typical hobbyist (unless you have the means to afford it). It's a device that enterprises could greatly benefit from. There are numerous scenarios in which your standard VR headset would falter, such as in very bright environments or outdoors, where typical devices wouldn't stand a chance. This is where the ML2 truly shines and, in my opinion, could be instrumental in addressing complex, specialized use cases that are challenging to solve with lower-end headsets.

Additional ML2 Dynamic Dimmer Resources

Here are a couple of resources I found helpful while testing these features, which I believe will assist you in understanding the entire process. I will include a GitHub repository that should get you started with everything you need. Additionally, I recommend downloading the Unity examples from the ML Hub, which also provides a global and segmented dimmer demo.

Previous
Previous

Magic Leap 2 INPUT API Features (Controller & Head Pose)

Next
Next

Quest 3 Mixed Reality With Meta Depth API - New Occlusion Features!