Exemplo n.º 1
0
        public static ARLightEstimate GetLightEstimate()
        {
            if (ARSessionManager.Instance.SessionStatus != ARSessionStatus.RUNNING &&
                ARSessionManager.Instance.SessionStatus != ARSessionStatus.PAUSED)
            {
                return(new ARLightEstimate(false, 1.0f));
            }
            ARLightEstimate lightEstimate = ARSessionManager.Instance.m_ndkSession.FrameAdapter.GetLightEstimate();

            return(lightEstimate);
        }
        void Update()
        {
#if UNITY_EDITOR
            Shader.SetGlobalFloat("_GlobalLightEstimation", 1.0f);
#else
            ARLightEstimate light = ARFrame.GetLightEstimate();
            if (!light.Valid)
            {
                return;
            }
            const float middleGray = 0.466f;

            float normalizedIntensity = light.PixelIntensity / middleGray;
            Shader.SetGlobalFloat("_GlobalLightEstimation", normalizedIntensity);
#endif
        }