Exemple #1
0
        private void Start()
        {
            frameWidth          = UnityCompositorInterface.GetFrameWidth();
            frameHeight         = UnityCompositorInterface.GetFrameHeight();
            outputYUV           = UnityCompositorInterface.OutputYUV();
            renderEvent         = UnityCompositorInterface.GetRenderEventFunc();
            hardwareEncodeVideo = UnityCompositorInterface.HardwareEncodeVideo();

            downsampleMat   = LoadMaterial("Downsample");
            YUVToRGBMat     = LoadMaterial("YUVToRGB");
            RGBToYUVMat     = LoadMaterial("RGBToYUV");
            BGRToRGBMat     = LoadMaterial("BGRToRGB");
            RGBToBGRMat     = LoadMaterial("BGRToRGB");
            NV12VideoMat    = LoadMaterial("RGBToNV12");
            BGRVideoMat     = LoadMaterial("BGRToRGB");
            holoAlphaMat    = LoadMaterial("HoloAlpha");
            extractAlphaMat = LoadMaterial("ExtractAlpha");
            ignoreAlphaMat  = LoadMaterial("IgnoreAlpha");
            quadViewMat     = LoadMaterial("QuadView");
            alphaBlendMat   = LoadMaterial("AlphaBlend");
            textureClearMat = LoadMaterial("TextureClear");

            SetHologramShaderAlpha(Compositor.DefaultAlpha);

            CreateColorTexture();
            CreateOutputTextures();

            SetupCameraAndRenderTextures();

            SetShaderValues();

            SetOutputTextures();
        }
        private void Start()
        {
            frameWidth          = UnityCompositorInterface.GetFrameWidth();
            frameHeight         = UnityCompositorInterface.GetFrameHeight();
            providesYUV         = UnityCompositorInterface.ProvidesYUV();
            expectsYUV          = UnityCompositorInterface.ExpectsYUV();
            renderEvent         = UnityCompositorInterface.GetRenderEventFunc();
            hardwareEncodeVideo = UnityCompositorInterface.HardwareEncodeVideo();

            downsampleMat      = LoadMaterial("Downsample");
            YUVToRGBMat        = LoadMaterial("YUVToRGB");
            RGBToYUVMat        = LoadMaterial("RGBToYUV");
            BGRToRGBMat        = LoadMaterial("BGRToRGB");
            RGBToBGRMat        = LoadMaterial("BGRToRGB");
            NV12VideoMat       = LoadMaterial("RGBToNV12");
            BGRVideoMat        = LoadMaterial("BGRToRGB");
            holoAlphaMat       = LoadMaterial("HoloAlpha");
            blurMat            = LoadMaterial("Blur");
            occlusionMaskMat   = LoadMaterial("OcclusionMask");
            extractAlphaMat    = LoadMaterial("ExtractAlpha");
            ignoreAlphaMat     = LoadMaterial("IgnoreAlpha");
            quadViewMat        = LoadMaterial("QuadView");
            alphaBlendMat      = LoadMaterial("AlphaBlend");
            textureClearMat    = LoadMaterial("TextureClear");
            colorCorrectionMat = LoadMaterial("ColorCorrection");

            videoFeedColorCorrection = ColorCorrection.GetColorCorrection(VideoFeedColorCorrectionPlayerPrefName);
            blurSize      = PlayerPrefs.GetFloat($"{nameof(TextureManager)}.{nameof(blurSize)}", 5);
            numBlurPasses = PlayerPrefs.GetInt($"{nameof(TextureManager)}.{nameof(numBlurPasses)}", 1);

            SetHologramShaderAlpha(Compositor.DefaultAlpha);

            CreateColorTexture();

            if (Compositor.OcclusionMode == OcclusionSetting.RawDepthCamera)
            {
                CreateDepthCameraTexture();
            }
            else if (Compositor.OcclusionMode == OcclusionSetting.BodyTracking)
            {
                CreateDepthCameraTexture();
                CreateBodyDepthTexture();
            }

            CreateOutputTextures();

            SetupCameraAndRenderTextures();

            SetShaderValues();

            SetOutputTextures();
        }
 /// <summary>
 /// Gets the height of the video frame.
 /// </summary>
 /// <returns>The height of the video frame, in pixels.</returns>
 public static int GetVideoFrameHeight()
 {
     return(UnityCompositorInterface.GetFrameHeight());
 }