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);
    }
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章