public void ConvertToEquirect (RenderTexture equirect, Camera.MonoOrStereoscopicEye eye);

Parameters

equirectRenderTexture to render the equirect format to.
eyeA Camera eye corresponding to the left or right eye for stereoscopic rendering, or neither for monoscopic rendering.

Description

Converts the render texture to equirectangular format (both stereoscopic or monoscopic equirect). The left eye will occupy the top half and the right eye will occupy the bottom. The monoscopic version will occupy the whole texture. Texture dimension must be of type TextureDimension.Cube.

using UnityEngine;
using UnityEngine.Rendering;

public class CreateEquirect : MonoBehaviour { public RenderTexture cubemap; public RenderTexture cubemap2; public RenderTexture equirect; public bool renderStereo = true; public float stereoSeparation = 0.064f;

void LateUpdate() { //assume cubemap and cubemap2 are rendered using Camera.RenderToCubemap() for left/right eyes

if (equirect == null) return;

if (renderStereo) { cubemap.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Left); cubemap2.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Right); } else { cubemap.ConvertToEquirect(equirect, Camera.MonoOrStereoscopicEye.Mono); } } }
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961