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


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