private void SetOutputTextures() { // hack, this forces the nativetexturepointer to be assigned inside the engine videoOutputTexture.colorBuffer.ToString(); displayOutputTexture.colorBuffer.ToString(); compositeTexture.colorBuffer.ToString(); UnityCompositorInterface.SetVideoRenderTexture(videoOutputTexture.GetNativeTexturePtr()); UnityCompositorInterface.SetOutputRenderTexture(displayOutputTexture.GetNativeTexturePtr()); UnityCompositorInterface.SetHoloTexture(compositeTexture.GetNativeTexturePtr()); }
public void InitializeVideoRecordingTextures() { var videoRecordingFrameWidth = Compositor.VideoRecordingFrameWidth; var videoRecordingFrameHeight = Compositor.VideoRecordingFrameHeight; NV12VideoMat.SetFloat("_Width", videoRecordingFrameWidth); NV12VideoMat.SetFloat("_Height", videoRecordingFrameHeight); // The output texture should always specify Linear read/write so that color space conversions are not performed when recording // the video when using Linear rendering in Unity. videoOutputTexture = new RenderTexture(videoRecordingFrameWidth, videoRecordingFrameHeight, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.Linear); videoOutputTexture.filterMode = FilterMode.Point; videoOutputTexture.anisoLevel = 0; videoOutputTexture.antiAliasing = 1; videoOutputTexture.depth = 0; videoOutputTexture.useMipMap = false; // hack, this forces the nativetexturepointer to be assigned inside the engine videoOutputTexture.colorBuffer.ToString(); UnityCompositorInterface.SetVideoRenderTexture(videoOutputTexture.GetNativeTexturePtr()); }