Version: 2020.3
LanguageEnglish
  • C#

RenderTexture.ConvertToEquirect

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Declaration

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

Parameters

equirect RenderTexture to render the equirect format to.
eye A 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