Unity 偏振3D左右格式画面制作

两个Camera相距6cm左右,分别渲染到两个1024*1024的RenderTexture上,然后在GUI上分别绘制出来。

using UnityEngine;
using System.Collections;

public class UI3D : MonoBehaviour
{

    public RenderTexture texCamLeft;
    public RenderTexture texCamRight;
    Rect rectCamLeft;
    Rect rectCamRight;

    // Use this for initialization
    void Start()
    {
        rectCamLeft = new Rect(0, -Screen.height * 0.25f, Screen.width * 0.5f, Screen.height * 2);
        rectCamRight = new Rect(Screen.width * 0.5f, -Screen.height * 0.25f, Screen.width * 0.5f, Screen.height * 2);
    }

    // Update is called once per frame
    void Update()
    {

    }

    void OnGUI()
    {
        GUI.depth = 2;
        GUI.DrawTexture(rectCamLeft, texCamLeft, ScaleMode.StretchToFill, false);
        GUI.DrawTexture(rectCamRight, texCamRight, ScaleMode.StretchToFill, false);
    }
}


你可能感兴趣的:(Unity 偏振3D左右格式画面制作)