Example #1
0
    void Update()
    {
        if (texOutput)
        {
            // blit the output texture
            BackgroundRemovalManager backManager = BackgroundRemovalManager.Instance;
            if (backManager && backManager.IsBackgroundRemovalInitialized())
            {
                if (foregroundMaterial)
                {
                    foregroundMaterial.SetTexture("_BodyTex", backManager.GetAlphaBodyTex());
                    Graphics.Blit(null, texOutput, foregroundMaterial, 0);
                }
                else
                {
                    Graphics.Blit(backManager.GetAlphaBodyTex(), texOutput);
                }
            }

            // set the gui texture, if needed
            GUITexture guiTexture = GetComponent <GUITexture>();
            if (guiTexture && guiTexture.texture == null)
            {
                guiTexture.texture = texOutput;
            }
        }
    }
Example #2
0
    void Update()
    {
        BackgroundRemovalManager backManager = BackgroundRemovalManager.Instance;

        if (backManager && backManager.IsBackgroundRemovalInitialized())
        {
            if (img && img.texture == null)
            {
                //img.texture = backManager.GetForegroundTex();
                img.texture = backManager.GetAlphaBodyTex();
            }
        }
    }
    void Update()
    {
        if (foregroundBlendMat && backgroundTexture &&
            kinectManager && kinectManager.IsInitialized())
        {
            if (!backManager)
            {
                backManager = BackgroundRemovalManager.Instance;
            }

            Texture alphaBodyTex = backManager ? backManager.GetAlphaBodyTex() : null;
            KinectInterop.SensorData sensorData = kinectManager.GetSensorData();

            if (backManager && backManager.IsBackgroundRemovalInitialized() &&
                alphaBodyTex && backgroundTexture && lastDepthFrameTime != sensorData.lastDepthFrameTime)
            {
                lastDepthFrameTime = sensorData.lastDepthFrameTime;
                foregroundBlendMat.SetTexture("_BodyTex", alphaBodyTex);
            }
        }
    }