/// <summary> /// Texture settings for stereo video capture. /// </summary> protected void CreateStereoTextures() { if (captureSource == CaptureSource.CAMERA && stereoMode != StereoMode.NONE) { // Stereo camera settings. regularCamera.transform.Translate(new Vector3(-interpupillaryDistance / 2, 0, 0), Space.Self); stereoCamera.transform.Translate(new Vector3(interpupillaryDistance / 2, 0, 0), Space.Self); // Init stereo video material. stereoPackMaterial = Utils.CreateMaterial("VideoCapture/StereoPack", stereoPackMaterial); stereoPackMaterial.DisableKeyword("STEREOPACK_TOP"); stereoPackMaterial.DisableKeyword("STEREOPACK_BOTTOM"); stereoPackMaterial.DisableKeyword("STEREOPACK_LEFT"); stereoPackMaterial.DisableKeyword("STEREOPACK_RIGHT"); // Init the temporary stereo target texture. stereoTexture = Utils.CreateRenderTexture(outputFrameWidth, outputFrameHeight, 24, antiAliasingSetting, stereoTexture); // Set stereo camera //if (captureMode == CaptureMode.REGULAR) // stereoCamera.targetTexture = stereoTexture; //else // stereoCamera.targetTexture = null; stereoCamera.targetTexture = stereoTexture; // Init the final stereo texture. stereoOutputTexture = Utils.CreateRenderTexture(outputFrameWidth, outputFrameHeight, 24, antiAliasingSetting, stereoOutputTexture); } }
/// <summary> /// Texture settings for cubemap capture. /// </summary> protected void CreateCubemapTextures() { // Create cubemap render target. cubemapRenderTarget = Utils.CreateRenderTexture(outputFrameWidth, outputFrameWidth, 0, antiAliasingSetting, cubemapRenderTarget); cubemapMaterial = Utils.CreateMaterial("VideoCapture/CubemapDisplay", cubemapMaterial); // Create cubemap render texture if (cubemapTexture == null) { cubemapTexture = new RenderTexture(cubemapSize, cubemapSize, 0); cubemapTexture.hideFlags = HideFlags.HideAndDontSave; #if UNITY_5_4_OR_NEWER cubemapTexture.dimension = UnityEngine.Rendering.TextureDimension.Cube; #else cubemapTexture.isCubemap = true; #endif } }
/// <summary> /// Texture settings for equirectangular capture. /// </summary> protected void CreateEquirectTextures() { if (captureMode == CaptureMode._360 && projectionType == ProjectionType.EQUIRECT) { // Create material for convert cubemap to equirectangular. equirectMaterial = Utils.CreateMaterial("VideoCapture/CubemapToEquirect", equirectMaterial); // Create equirectangular render texture. equirectTexture = Utils.CreateRenderTexture(cubemapSize, cubemapSize, 24, antiAliasingSetting, equirectTexture, false); equirectTexture.dimension = UnityEngine.Rendering.TextureDimension.Cube; if (stereoMode != StereoMode.NONE) { // Create stereo equirectangular render texture. stereoEquirectTexture = Utils.CreateRenderTexture(cubemapSize, cubemapSize, 24, antiAliasingSetting, stereoEquirectTexture, false); stereoEquirectTexture.dimension = UnityEngine.Rendering.TextureDimension.Cube; } } }