Global Dimming doesn't work

Hi, I am testing the global dimming of magic leap 2 with this code:

using UnityEngine;
using TMPro; 
using UnityEngine.XR.MagicLeap; 

public class DimmerTest : MonoBehaviour
{
    public float period = 2.0f;
    [SerializeField, Tooltip("Debug bar")]
    private TextMeshProUGUI DebugText;

    void Update()
    { 
        float t = (Time.timeSinceLevelLoad % period) / period;
        float dimmer = -0.5f * Mathf.Cos(2.0f * Mathf.PI * t) + 0.5f;

        try
        {
            MLGlobalDimmer.SetValue(dimmer);
            Debug.Log("Set dimmer to " + dimmer);
            DebugText.text = $"Dimmer level: {dimmer:0.00}";
        }
        catch (System.Exception e)
        {
            Debug.Log(e.Message);
            DebugText.text = $"Error setting dimmer: {e.Message}";
        }
    }
}

When I test this code with both App simulation/real device, it successfully printed out the Dimmer level with no error output. Also, the code are all complied correctly. However, in my view of glasses, the background didn't changed at all while it should be frequently changed from black to light as the doc below shows.

For information of my system, I am on WIndows 10, using unity 2022.2.0.f1, MLC SDK is 1.5.0 and Magic Leap Application Simulator (ZI) Runtime version is 3.8.0.20231028, and the ML2 OS version is 1.4.1.

Any hints will be appreciate.

The global dimmer will not work in app simulator. Are you using the OpenXR Workflow or the standard XR Workflow?

I am using the standard XR workflow with Unity MLSDK.
I referred the page here:

If you are using the XR Workflow, do you mind using the 1.12.0 Unity SDK in your project if you are not already doing so?

Thank you, I will try that but not sure if there will be some conflict if I downgrade to 1.12.0. Is XR Workflow no more support global dimming/have some potential problems with SDK version higher than 1.12.0? Will that be fixed in the future as we also want to add pupil size detection if it is supported in the future version.

Also, I don't think there are MLSDK package with version 1.12.0 on Magic leap hub. If you mean the Unity package, I am currently using 2.0 and can downgrade to 1.12.0

Hi, I have tried with the Unity package 1.12.0 and it still doesn't work. The performance was same as I described above.

Hi, this solution doesn't work, are there any other possible ways to fix it?

Can you verify that the dimmer works properly in the 1.12.0 Magic Leap Unity Examples?

Note, this is the script that is used in the example project:

    public class GlobalDimmerExample : MonoBehaviour
    {
        [SerializeField, Range(0f, 1f)]
        private float startingValue = 0.2f;

        [SerializeField]
        private UnityEngine.UI.Slider slider;

        private void Start()
        {
            slider.value = startingValue;
        }

        public void SetDimmerValue(float value)
        {
            MLGlobalDimmer.SetValue(value);
        }
    }

You may want to check your device's display settings and make sure that the Max Dimming value was not disabled.

Hi, you are correct. In the setting part, the Global dimming is disabled with notification: disabled due to display preset
However, I didn't found any options in display setting page to enable it. May I have some hints about how to enable it?
Capture

The Display Modes option under Display Override can be adjusted.

Thank you, it works.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.