// Update is called once per frame
    void Update()
    {
        if (zed.IsCameraReady)         //Don't do anything unless the ZED has been initialized.
        {
            if (numberPoints == 0)
            {
                //Create the textures. These will be updated automatically by the ZED.
                //We'll copy them each frame into XYZTextureCopy and ColorTextureCopy, which will be the ones actually displayed.
                XYZTexture   = zed.CreateTextureMeasureType(sl.MEASURE.XYZ);
                colorTexture = zed.CreateTextureImageType(sl.VIEW.LEFT);
                numberPoints = zed.ImageWidth * zed.ImageHeight;

                //Load and set the material properties.
                mat = new Material(Resources.Load("Materials/PointCloud/Mat_ZED_PointCloud") as Material);
                if (mat != null)
                {
                    //mat.SetTexture("_XYZTex", XYZTexture);
                    mat.SetTexture(xyzTexID, XYZTexture);
                    //mat.SetTexture("_ColorTex", colorTexture);
                    mat.SetTexture(colorTexID, colorTexture);
                }
            }

            //If stop updated, create new render texture and fill them with the textures from the ZED.
            // These textures will be displayed as they are not updated
            if (!update && previousUpdate != update)
            {
                if (XYZTextureCopy == null)
                {
                    XYZTextureCopy = new RenderTexture(XYZTexture.width, XYZTexture.height, 0, RenderTextureFormat.ARGBFloat);
                }

                if (ColorTextureCopy == null)
                {
                    ColorTextureCopy = new RenderTexture(colorTexture.width, colorTexture.height, 0, RenderTextureFormat.ARGB32);
                }

                //Copy the new textures into the buffers.
                Graphics.Blit(XYZTexture, XYZTextureCopy);
                Graphics.Blit(colorTexture, ColorTextureCopy);

                if (mat != null)
                {
                    //mat.SetTexture("_XYZTex", XYZTextureCopy);
                    mat.SetTexture(xyzTexID, XYZTextureCopy);
                    //mat.SetTexture("_ColorTex", ColorTextureCopy);
                    mat.SetTexture(colorTexID, ColorTextureCopy);
                }
            }
            //Send the textures to the material/shader.
            if (update && previousUpdate != update && mat != null)
            {
                //mat.SetTexture("_XYZTex", XYZTexture);
                mat.SetTexture(xyzTexID, XYZTexture);
                //mat.SetTexture("_ColorTex", colorTexture);
                mat.SetTexture(colorTexID, colorTexture);
            }
            previousUpdate = update;
        }
    }
示例#2
0
    void Start()
    {
        //Set textures to the shader
        matRGB = canvas.GetComponent <Renderer>().material;
        sl.ZEDCamera zedCamera = sl.ZEDCamera.GetInstance();

        //Create two textures and fill them with the ZED computed images
        if (whichCamera == 0)
        {
            camZed = zedCamera.CreateTextureImageType(sl.VIEW.LEFT);
        }
        else if (whichCamera == 1)
        {
            camZed = zedCamera.CreateTextureImageType(sl.VIEW.RIGHT);
        }
        depthXYZZed = zedCamera.CreateTextureMeasureType(sl.MEASURE.XYZ);
        matRGB.SetTexture("_CameraTex", camZed);
        matRGB.SetTexture("_DepthXYZTex", depthXYZZed);

        if (zedCamera.CameraIsReady)
        {
            mainCamera.fieldOfView      = zedCamera.GetFOV() * Mathf.Rad2Deg;
            mainCamera.projectionMatrix = zedCamera.Projection;

            scale(canvas.gameObject, GetFOVFromProjectionMatrix(mainCamera.projectionMatrix));
        }
        else
        {
            scale(canvas.gameObject, mainCamera.fieldOfView);
        }
    }
示例#3
0
    void Start()
    {
        //Set textures to the shader
        matRGB = canvas.GetComponent <Renderer>().material;
        sl.ZEDCamera zedCamera = sl.ZEDCamera.GetInstance();

        //Create two textures and fill them with the ZED computed images
        zedCamera.SetGrabParametersThreadingMode(sl.SENSING_MODE.FILL, true);

        camZedLeft  = zedCamera.CreateTextureImageType(videoType); //this gets set to LEFT from some magic...
        depthXYZZed = zedCamera.CreateTextureMeasureType(sl.MEASURE.XYZ);
        matRGB.SetTexture("_CameraTex", camZedLeft);
        matRGB.SetTexture("_DepthXYZTex", depthXYZZed);

        if (zedCamera.CameraIsReady)
        {
            mainCamera.fieldOfView      = zedCamera.GetFOV() * Mathf.Rad2Deg;
            mainCamera.projectionMatrix = zedCamera.Projection;

            monitorCamera.fieldOfView      = zedCamera.GetFOV() * Mathf.Rad2Deg;
            monitorCamera.projectionMatrix = zedCamera.Projection;

            scale(canvas.gameObject, GetFOVFromProjectionMatrix(mainCamera.projectionMatrix), false);
            scale(monitorCanvas.gameObject, GetFOVFromProjectionMatrix(monitorCamera.projectionMatrix), true);
        }
        else
        {
            scale(canvas.gameObject, mainCamera.fieldOfView, false);
            scale(monitorCanvas.gameObject, monitorCamera.fieldOfView, true);
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (zed.CameraIsReady)
        {
            if (numberPoints == 0)
            {
                XYZTexture   = zed.CreateTextureMeasureType(sl.MEASURE.XYZ);
                colorTexture = zed.CreateTextureImageType(sl.VIEW.LEFT);
                numberPoints = zed.ImageWidth * zed.ImageHeight;


                mat = Resources.Load("Materials/Mat_ZED_PCL") as Material;
                if (mat != null)
                {
                    mat.SetTexture("_XYZTex", XYZTexture);
                    mat.SetTexture("_ColorTex", colorTexture);
                }
            }


            if (!update && previousUpdate != update)
            {
                if (XYZTextureCopy == null)
                {
                    XYZTextureCopy = new RenderTexture(XYZTexture.width, XYZTexture.height, 0, RenderTextureFormat.ARGBFloat);
                }

                if (ColorTextureCopy == null)
                {
                    ColorTextureCopy = new RenderTexture(colorTexture.width, colorTexture.height, 0, RenderTextureFormat.ARGB32);
                }



                Graphics.Blit(XYZTexture, XYZTextureCopy);
                Graphics.Blit(colorTexture, ColorTextureCopy);

                if (mat != null)
                {
                    mat.SetTexture("_XYZTex", XYZTextureCopy);
                    mat.SetTexture("_ColorTex", ColorTextureCopy);
                }
            }

            if (update && previousUpdate != update && mat != null)
            {
                mat.SetTexture("_XYZTex", XYZTexture);
                mat.SetTexture("_ColorTex", colorTexture);
            }

            // ADDED FUNCTION
            //DepthSense_Test3 test = new DepthSense_Test3();
            //test.run_depth_sense();
            //mat.SetColor ("_XYZTex", Color.magenta);

            previousUpdate = update;
        }
    }
示例#5
0
    // Update is called once per frame
    void Update()
    {
        if (zed.IsCameraReady)
        {
            if (numberPoints == 0)
            {
                //Creations of the textures
                XYZTexture   = zed.CreateTextureMeasureType(sl.MEASURE.XYZ);
                colorTexture = zed.CreateTextureImageType(sl.VIEW.LEFT);
                numberPoints = zed.ImageWidth * zed.ImageHeight;

                //Load and set the materials properties
                mat = Resources.Load("Materials/PointCloud/Mat_ZED_PointCloud") as Material;
                if (mat != null)
                {
                    mat.SetTexture("_XYZTex", XYZTexture);
                    mat.SetTexture("_ColorTex", colorTexture);
                }
            }

            //If stop updated, create new render texture and fill them with the textures from the ZED.
            // These textures will be displayed as they are not updated
            if (!update && previousUpdate != update)
            {
                if (XYZTextureCopy == null)
                {
                    XYZTextureCopy = new RenderTexture(XYZTexture.width, XYZTexture.height, 0, RenderTextureFormat.ARGBFloat);
                }

                if (ColorTextureCopy == null)
                {
                    ColorTextureCopy = new RenderTexture(colorTexture.width, colorTexture.height, 0, RenderTextureFormat.ARGB32);
                }



                Graphics.Blit(XYZTexture, XYZTextureCopy);
                Graphics.Blit(colorTexture, ColorTextureCopy);

                if (mat != null)
                {
                    mat.SetTexture("_XYZTex", XYZTextureCopy);
                    mat.SetTexture("_ColorTex", ColorTextureCopy);
                }
            }
            //Display the right textures
            if (update && previousUpdate != update && mat != null)
            {
                mat.SetTexture("_XYZTex", XYZTexture);
                mat.SetTexture("_ColorTex", colorTexture);
            }
            previousUpdate = update;
        }
    }
    void OnZEDReady()
    {
        //Create the textures. These will be updated automatically by the ZED.
        XYZTexture = zed.CreateTextureMeasureType(sl.MEASURE.XYZ);
        colTexture = zed.CreateTextureImageType(sl.VIEW.LEFT);

        // Initialize rendertexture if needed
        if (vertexRenderTexture == null)
        {
            vertexRenderTexture = new RenderTexture(XYZTexture.width, XYZTexture.height, 0, RenderTextureFormat.ARGBFloat);
            vertexRenderTexture.enableRandomWrite = true;
            vertexRenderTexture.useMipMap         = false;
            vertexRenderTexture.filterMode        = FilterMode.Point;
            vertexRenderTexture.Create();

            vertexTexture = (Texture)vertexRenderTexture;
        }

        if (colorRenderTexture == null)
        {
            colorRenderTexture = new RenderTexture(colTexture.width, colTexture.height, 0, RenderTextureFormat.BGRA32);
            colorRenderTexture.enableRandomWrite = true;
            colorRenderTexture.useMipMap         = false;
            colorRenderTexture.Create();

            colorTexture = (Texture)colorRenderTexture;
        }

        vertexTextureGeneratorKernelId = TextureGenerator.FindKernel("VertexGenerator");

        TextureGenerator.SetTexture(vertexTextureGeneratorKernelId, "Input_positionData", XYZTexture);
        TextureGenerator.SetInt("depthWidth", XYZTexture.width);
        TextureGenerator.SetInt("depthHeight", XYZTexture.height);

        TextureGenerator.SetTexture(vertexTextureGeneratorKernelId, "Output_vertexTexture", vertexRenderTexture);


        colorTextureGeneratorKernelId = TextureGenerator.FindKernel("ColorGenerator");

        TextureGenerator.SetTexture(colorTextureGeneratorKernelId, "Input_colorData", colTexture);
        TextureGenerator.SetInt("colorWidth", colorTexture.width);
        TextureGenerator.SetInt("colorHeight", colorTexture.height);

        TextureGenerator.SetTexture(colorTextureGeneratorKernelId, "Output_colorTexture", colorRenderTexture);
    }
示例#7
0
    void Start()
    {
        //Set textures to the shader
        //matRGB = canvas.GetComponent<Renderer>().material;
        sl.ZEDCamera zedCamera = sl.ZEDCamera.GetInstance();
        if (videoType == sl.VIEW.LEFT_GREY || videoType == sl.VIEW.RIGHT_GREY || videoType == sl.VIEW.LEFT_UNRECTIFIED_GREY || videoType == sl.VIEW.RIGHT_UNRECTIFIED_GREY)
        {
            matRGB.SetInt("_isGrey", 1);
        }
        else
        {
            matRGB.SetInt("_isGrey", 0);
        }

        //Create two textures and fill them with the ZED computed images

        // TextureFormat.RGBA32
        camZedLeft = zedCamera.CreateTextureImageType(videoType);

        // TextureFormat.RGBAFloat,
        depthXYZZed = zedCamera.CreateTextureMeasureType(sl.MEASURE.XYZ);
        matRGB.SetTexture("_CameraTex", camZedLeft);
        matRGB.SetTexture("_DepthXYZTex", depthXYZZed);

        //matEncoded.SetTexture("_CameraTex", camZedLeft);
        matEncoded.SetTexture("_DepthXYZTex", depthXYZZed);


        if (zedCamera.CameraIsReady)
        {
            mainCamera.fieldOfView      = zedCamera.GetFOV() * Mathf.Rad2Deg;
            mainCamera.projectionMatrix = zedCamera.Projection;

            scale(canvas.gameObject, GetFOVFromProjectionMatrix(mainCamera.projectionMatrix));
        }
        else
        {
            scale(canvas.gameObject, mainCamera.fieldOfView);
        }
    }
示例#8
0
    /// <summary>
    /// Create and set the textures
    /// </summary>
    /// <param name="zedCamera"></param>
    private void SetTextures(sl.ZEDCamera zedCamera, sl.VIEW_MODE view_mode)
    {
        float baseline = zedCamera.Baseline;

        canvas.transform.localRotation = Quaternion.identity;
        canvas.transform.localPosition = new Vector3(0, 0, 0);

        if (StereoTargetEyeMask.Left == mainCamera.stereoTargetEye)
        {
            side = 0;
            if (zedCamera != null && zedCamera.IsCameraReady)
            {
                renderTextureTarget      = new RenderTexture(zedCamera.ImageWidth, zedCamera.ImageHeight, 24, RenderTextureFormat.ARGB32);
                mainCamera.targetTexture = renderTextureTarget;
            }

            switch (view_mode)
            {
            case sl.VIEW_MODE.VIEW_IMAGE:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.LEFT);
                break;

            case sl.VIEW_MODE.VIEW_DEPTH:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.DEPTH);
                break;

            case sl.VIEW_MODE.VIEW_NORMALS:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.NORMALS);
                break;
            }

            normals = zedCamera.CreateTextureMeasureType(sl.MEASURE.NORMALS, resolution);
            depth   = zedCamera.CreateTextureMeasureType(sl.MEASURE.DEPTH, resolution);
        }
        else if (StereoTargetEyeMask.Right == mainCamera.stereoTargetEye)
        {
            side = 1;
            if (zedCamera != null && zedCamera.IsCameraReady)
            {
                renderTextureTarget      = new RenderTexture(zedCamera.ImageWidth, zedCamera.ImageHeight, 24, RenderTextureFormat.ARGB32);
                mainCamera.targetTexture = renderTextureTarget;
            }

            switch (view_mode)
            {
            case sl.VIEW_MODE.VIEW_IMAGE:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.RIGHT);
                break;

            case sl.VIEW_MODE.VIEW_DEPTH:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.DEPTH_RIGHT);
                break;

            case sl.VIEW_MODE.VIEW_NORMALS:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.NORMALS_RIGHT);
                break;
            }
            normals = zedCamera.CreateTextureMeasureType(sl.MEASURE.NORMALS_RIGHT, resolution);
            depth   = zedCamera.CreateTextureMeasureType(sl.MEASURE.DEPTH_RIGHT, resolution);
        }
        else
        {
            side = 0;
            switch (view_mode)
            {
            case sl.VIEW_MODE.VIEW_IMAGE:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.LEFT);
                break;

            case sl.VIEW_MODE.VIEW_DEPTH:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.DEPTH);
                break;

            case sl.VIEW_MODE.VIEW_NORMALS:
                textureEye = zedCamera.CreateTextureImageType(sl.VIEW.NORMALS);
                break;
            }
            normals = zedCamera.CreateTextureMeasureType(sl.MEASURE.NORMALS, resolution);
            depth   = zedCamera.CreateTextureMeasureType(sl.MEASURE.DEPTH, resolution);
        }
    }
    void Update()
    {
        //Wait until the zed is awake *rise n shine*
        if (zed.IsCameraReady)
        {
            //this 2D color texture from zed but has no usuable color values until
            //it is passed into the GPU. Then a Unity shader can correct it into BGRA32
            colorTexture = zed.CreateTextureImageType(sl.VIEW.LEFT);
            XYZTexture   = zed.CreateTextureMeasureType(sl.MEASURE.XYZ);

            //if our GPU is hungry
            if (ColorTextureCopy == null)
            {
                //create a rendertexture with the same specs as our color texture
                ColorTextureCopy = new RenderTexture(colorTexture.width, colorTexture.height, 0, RenderTextureFormat.ARGB32);
            }

            if (XYZTextureCopy == null)
            {
                XYZTextureCopy = new RenderTexture(XYZTexture.width, XYZTexture.height, 0, RenderTextureFormat.ARGBFloat);
            }

            //feed the GPU a colortexture from the CPU *nom nom nom nom*
            Graphics.Blit(XYZTexture, XYZTextureCopy);
            Graphics.Blit(colorTexture, ColorTextureCopy);

            //make sure we found our material and loaded it.
            if (m != null)
            {
                //set our materials main texture to the rgb values stored in the GPU
                m.SetTexture("_ColorTex", ColorTextureCopy);
                m.SetTexture("_XYZTex", XYZTextureCopy);

                //Get the GPU corrected pixel data and store it into a 2D texture
                if (togglermcjoggler)
                {
                    tex = GetRTPixels(XYZTextureCopy);
                }
                else
                {
                    tex = GetRTPixels(ColorTextureCopy);
                }

                //Apply those values to the 2D texture
                tex.Apply();

                //Turn the RGBA32 pixel data into a byte array
                imgData = tex.GetRawTextureData();

                //Pass that byte array to our OpenCV counterpart through the wrapper function SobelFrame
                imgData = SobelFrame(imgData, 1920, 1080);

                //Load whatever OpenCV returned into a RGBA32 2D Texture
                tex.LoadRawTextureData(imgData);

                //Apply those values to the 2D texture
                tex.Apply();

                //Free the byte array on the OpenCV counterpart through the wrapper function FreeMem
                FreeMem();

                //Set our material's main texture to whatever OpenCV returned
                m.mainTexture = tex;
            }
        }
    }
示例#10
0
    void Start()
    {
#if UNITY_EDITOR
        UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect16by9, true);
        UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect16by10, false);
        UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect4by3, false);
        UnityEditor.PlayerSettings.SetAspectRatio(UnityEditor.AspectRatio.Aspect5by4, false);
#endif

        bounds = new Bounds(transform.position, new Vector3(30, 30, 30));

        sl.ZEDCamera zedCamera = sl.ZEDCamera.GetInstance();
        //Set the camera parameters and scale the screen
        if (zedCamera.CameraIsReady)
        {
            mainCamera.fieldOfView      = zedCamera.GetFOV() * Mathf.Rad2Deg;
            mainCamera.projectionMatrix = zedCamera.Projection;
            mainCamera.nearClipPlane    = 0.2f;
            mainCamera.farClipPlane     = 500.0f;
            scale(canvas.gameObject, GetFOVFromProjectionMatrix(mainCamera.projectionMatrix));
        }
        else
        {
            scale(canvas.gameObject, mainCamera.fieldOfView);
        }

        if (xyz)
        {
            Shader.EnableKeyword("ZED_XYZ");
            depthXYZZed = zedCamera.CreateTextureMeasureType(sl.MEASURE.XYZ);
        }
        else
        {
            Shader.DisableKeyword("ZED_XYZ");
            depthXYZZed = zedCamera.CreateTextureMeasureType(sl.MEASURE.DEPTH);
        }
        camZedLeft = zedCamera.CreateTextureImageType(videoType);

        normals = zedCamera.CreateTextureMeasureType(sl.MEASURE.NORMALS);

        //If forward mode is activated
        if (mainCamera.actualRenderingPath == RenderingPath.Forward)
        {
            Shader.SetGlobalInt("_HasShadows", 0);

            gameObject.transform.GetChild(0).GetComponent <MeshRenderer>().enabled = true;

            //Set textures to the shader
            matRGB = canvas.GetComponent <Renderer>().material;
            matRGB.SetInt("_isLinear", System.Convert.ToInt32(QualitySettings.activeColorSpace));

            forwardMat = Resources.Load("Materials/Mat_ZED_Forward") as Material;

            if (videoType == sl.VIEW.LEFT_GREY || videoType == sl.VIEW.RIGHT_GREY || videoType == sl.VIEW.LEFT_UNRECTIFIED_GREY || videoType == sl.VIEW.RIGHT_UNRECTIFIED_GREY)
            {
                matRGB.SetInt("_isGrey", 1);
            }
            else
            {
                matRGB.SetInt("_isGrey", 0);
            }

            GameObject o = GameObject.CreatePrimitive(PrimitiveType.Quad);
            o.name                    = "ZED_FORCE_SHADOW";
            o.transform.parent        = transform;
            o.transform.localScale    = new Vector3(0.001f, 0.001f, 0.001f);
            o.transform.localPosition = new Vector3(0, 0, mainCamera.nearClipPlane);
            o.GetComponent <MeshRenderer>().sharedMaterial = Resources.Load("Materials/Mat_ZED_Nothing") as Material;
            Destroy(o.GetComponent <MeshCollider>());
            o.hideFlags = HideFlags.HideAndDontSave;

            matRGB.SetTexture("_MainTex", camZedLeft);
            matRGB.SetTexture("_CameraTex", camZedLeft);
            matRGB.SetTexture("_DepthXYZTex", depthXYZZed);
            matRGB.SetTexture("_NormalsTex", normals);

            forwardMat.SetTexture("_MainTex", camZedLeft);
            forwardMat.SetTexture("_DepthXYZTex", depthXYZZed);

            buffer      = new CommandBuffer();
            buffer.name = "ZED_DEPTH";
            buffer.SetRenderTarget(BuiltinRenderTextureType.CurrentActive, BuiltinRenderTextureType.Depth);
            buffer.DrawMesh(mesh.mesh, gameObject.transform.GetChild(0).transform.localToWorldMatrix, forwardMat);

            // mainCamera.AddCommandBuffer(CameraEvent.BeforeDepthTexture, buffer);

            computeBuffePointLight = new ComputeBuffer(NUMBER_POINT_LIGHT_MAX, SIZE_POINT_LIGHT_BYTES);
            computeBuffePointLight.SetData(pointLights);
            matRGB.SetBuffer("pointLights", computeBuffePointLight);

            computeBufferSpotLight = new ComputeBuffer(NUMBER_SPOT_LIGHT_MAX, SIZE_SPOT_LIGHT_BYTES);
            computeBufferSpotLight.SetData(spotLights);
            matRGB.SetBuffer("spotLights", computeBufferSpotLight);

            zedCamera.SetDepthMaxRangeValue(15);
        }
        else if (mainCamera.actualRenderingPath == RenderingPath.DeferredShading)
        {
            //Sets the custom shader for the deferred pipeline
            GraphicsSettings.SetCustomShader(BuiltinShaderType.DeferredShading, (Resources.Load("Materials/Mat_ZED_Custom_Deferred") as Material).shader);

            deferredMat = Resources.Load("Materials/Mat_ZED_Deferred") as Material;

            deferredMat.SetTexture("_MainTex", camZedLeft);
            deferredMat.SetTexture("_DepthXYZTex", depthXYZZed);
            deferredMat.SetTexture("_NormalsTex", normals);

            //gameObject.transform.GetChild(0).GetComponent<MeshRenderer>().enabled = false;
            buffer      = new CommandBuffer();
            buffer.name = "ZED_DEPTH";

            RenderTargetIdentifier[] mrt = { BuiltinRenderTextureType.GBuffer0, BuiltinRenderTextureType.GBuffer1, BuiltinRenderTextureType.GBuffer2, BuiltinRenderTextureType.GBuffer3 };
            buffer.SetRenderTarget(mrt, BuiltinRenderTextureType.CameraTarget);
            buffer.DrawMesh(mesh.mesh, gameObject.transform.GetChild(0).transform.localToWorldMatrix, deferredMat);

            //Set an object in the scene to force shadow casting
            gameObject.transform.GetChild(0).position   = new Vector3(0, 0, mainCamera.nearClipPlane);
            gameObject.transform.GetChild(0).localScale = new Vector3(0.01f, 0.01f, 0.01f);
            gameObject.transform.GetChild(0).GetComponent <MeshRenderer>().sharedMaterial = Resources.Load("Materials/Mat_ZED_Nothing") as Material;

            buffer.SetRenderTarget(BuiltinRenderTextureType.CameraTarget);
            mainCamera.AddCommandBuffer(CameraEvent.AfterGBuffer, buffer);
        }
        else
        {
            Debug.LogError(" [ ZED Plugin ] : The rendering path " + mainCamera.actualRenderingPath.ToString() + " is not compatible with the ZED");
        }
    }