Log in or register to post comments

ARCore AmbientColorTemperature

January 22, 2019 - 12:29pm #1

Is AmbientColorTemperature through the IlluminationManager supported on ARCore devices? I'm able to get a value for AmbientIntensity but not the other.

ARCore AmbientColorTemperature

April 2, 2019 - 12:04pm #9

Hello @Shipp236,

We are aware of inconsistencies in our support for ARCore values being returned by Vuforia Engine APIs, including the issue you're reporting. We hope to address them soon in an upcoming commercial release.

Apologies for any inconvenience this may cause.

Thanks,

Vuforia Engine Support

ARCore AmbientColorTemperature

April 2, 2019 - 3:49am #8

I'm referencing the Vuforia API where the value of AmbientColorTemperature is being returned as null despite the fact that ARCore provides a value for this myprepaidcenter.

ARCore AmbientColorTemperature

March 14, 2019 - 12:06am #7

The first request was to be able to write cross-platform code so that they could target both ARKit and ARCore (and other platforms as they came out). This request tied in very well with Unity’s core value of democratizing development by allowing creators to write once, deploy anywhere.

ARCore AmbientColorTemperature

January 28, 2019 - 3:17pm #6

Hello,

I sent you a direct message from the Vuforia forums. After logging into the Vuforia Developer Portal, click on "Messages"  in the upper right-hand corner of the browser by your log in ID.

Thanks,

Vuforia Engine Support

ARCore AmbientColorTemperature

January 24, 2019 - 8:43am #5

Certainly. Using the below script that was posted in the Unity forums.

<pre class="brush: csharp;">using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using Vuforia;

using UnityEngine.Rendering;



/// <summary>

/// Light estimation manager.

/// Used to retrive light estimation from vuforia API.

/// </summary>

public class LightEstimationManager : MonoBehaviour

{

    /// <summary>

    /// The color temperature in Kelvin.

    /// Might be null if no Light Estimation is available.

    /// </summary>

    public float? colorTemperature { get; private set; }

    /// <summary>

    /// The color intensity between 0-8.

    /// Please note it's not the same as IlluminationManager.AmbientIntensity.

    /// IlluminationManager.AmbientIntensity is on an internal AR kit format.

    /// Might be null if no Light Estimation is available.

    /// </summary>

    public float? intensity { get; private set; }

    /// <summary>

    /// The light estimation active.

    /// </summary>

    public bool isLightEstimationCalculationActive { get; private set; }

    /// <summary>

    /// Vyforia illumination manager.

    /// </summary>

    IlluminationManager illuminationManager;

    /// <summary>

    /// The is vuforia initialized.

    /// </summary>

    private bool isVuforiaInitialized;

    /// <summary>

    /// Is the color temperature available?

    /// </summary>

    private bool isColorTemperatureAvailable;

    /// <summary>

    /// Is the intensity data available?

    /// </summary>

    private bool isIntensityAvailable;

    /// <summary>

    /// The instance.

    /// </summary>

    private static LightEstimationManager instance;

    /// <summary>

    /// Gets the instance.

    /// </summary>

    /// <value>The instance.</value>

    public static LightEstimationManager Instance

    {

        get { return instance; }

    }



    void Awake()

    {

        instance = this;

    }

    void OnEnable()

    {

        // Wait for Vuforia to start before attempting to get Light Estimation values.

        VuforiaARController.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted);

    }

    void OnDisable()

    {

        VuforiaARController.Instance.UnregisterVuforiaStartedCallback(OnVuforiaStarted);

    }



    /// <summary>

    /// Sets the light estimation calculation active or disabled.

    /// </summary>

    /// <param name="isActive">If set to <c>true</c> is active.</param>

    public void SetLightEstimationCalculation(bool isActive)

    {

        isLightEstimationCalculationActive = isActive;

        Debug.Log("Light Estimation calculation is set to: " + isActive.ToString());

    }



    /// <summary>

    /// Raises the vuforia started event.

    /// </summary>

    void OnVuforiaStarted()

    {

        Debug.Log("Vuforia Started.");

        var stateManager = TrackerManager.Instance.GetStateManager();

        if (stateManager == null)

        {

            Debug.LogError("No State Manager can be found on Vuforia Start.");

            return;

        }

        illuminationManager = stateManager.GetIlluminationManager();

        if (illuminationManager == null)

        {

            Debug.LogError("No State Illumination Manager can be found on Vuforia Start.");

            return;

        }

        isLightEstimationCalculationActive = true;

        isVuforiaInitialized = true;

    }



    void Update()

    {

        if (isLightEstimationCalculationActive && isVuforiaInitialized)

        {

            CheckIlluminationStatus();

        }

    }



    /// <summary>

    /// Check if the illumination status is available

    /// </summary>

    void CheckIlluminationStatus()

    {

        if (!isVuforiaInitialized)

        {

            Debug.Log("Vuforia isn't inizialized yet.");

            return;

        }

        ShowLightEstimationStatusLogs();

        isColorTemperatureAvailable = IsColorTemperatureAvailable(illuminationManager);

        isIntensityAvailable = IsIntensityAvailable(illuminationManager);

        if (isColorTemperatureAvailable && isIntensityAvailable)

        {

            SetLightEstimationValue();

        }

    }



    /// <summary>

    /// Shows the light estimation status logs.

    /// </summary>

    void ShowLightEstimationStatusLogs()

    {

        if (isColorTemperatureAvailable != IsColorTemperatureAvailable(illuminationManager))

        {

            Debug.Log("Ambient Illumination info avilability changed. Is now color temperature available? " + IsColorTemperatureAvailable(illuminationManager));

        }

        if (isColorTemperatureAvailable != IsIntensityAvailable(illuminationManager))

        {

            Debug.Log("Ambient Illumination info changed. Is now intensity available? " + IsIntensityAvailable(illuminationManager));

        }

    }

    /// <summary>

    /// Returns if the color temperature value returned from Vuforia, is available or not.

    /// </summary>

    /// <returns><c>true</c> if the color temperature value is available ; otherwise, <c>false</c>.</returns>

    /// <param name="illuminationManager">Illumination manager.</param>

    bool IsColorTemperatureAvailable(IlluminationManager illuminationManager)

    {

        return (illuminationManager.AmbientColorTemperature != null);

    }

    /// <summary>

    /// Returns if the intensity value returned from Vuforia, is available or not.

    /// </summary>

    /// <returns><c>true</c> if the color temperature value is available ; otherwise, <c>false</c>.</returns>

    /// <param name="illuminationManager">Illumination manager.</param>

    bool IsIntensityAvailable(IlluminationManager illuminationManager)

    {

        return (illuminationManager.AmbientIntensity != null);

    }

    /// <summary>

    /// Sets the light estimation value.

    /// </summary>

    void SetLightEstimationValue()

    {

        GraphicsSettings.lightsUseLinearIntensity = true;

        GraphicsSettings.lightsUseColorTemperature = true;

        intensity = ((illuminationManager.AmbientIntensity.Value) / (1000.0f));

        colorTemperature = illuminationManager.AmbientColorTemperature.Value;

    }

}</pre>

ARCore AmbientColorTemperature

January 23, 2019 - 2:38pm #4

Hello,

Can you send a code snippet for how you're using the API? If it is something that can easily be dropped into our Core samples that will make replication simpler and quicker.

Thanks,

Vuforia Engine Support

ARCore AmbientColorTemperature

January 23, 2019 - 8:58am #3

Not quite. I'm referencing the Vuforia API where the value of AmbientColorTemperature is being returned as null despite the fact that ARCore provides a value for this.

 

https://library.vuforia.com/content/vuforia-library/en/reference/unity/classVuforia_1_1IlluminationManager.html

ARCore AmbientColorTemperature

January 22, 2019 - 2:19pm #2

Hello,

Does this forum user post help?

https://developer.vuforia.com/forum/unity-extension-technical-discussion/light-matching#comment-64299

Thanks,

Vuforia Engine Support

Log in or register to post comments