In-world "screen" from camera?

Background

I’ve made a prototype of a space simulator, It’s based loosely on the idea of a “space shuttle simulator”. I’m going for the realistic approach, which means that I’m trying to shun exterior views.

The problem

I want to have screens in my cockpit, so the player can swivel their head and look at a virtual screen. I’ve been using “Normalized Viewport Rectangles” in my prototyping process; but that’s not a permanent solution. I am unsure if this is possible, and even more unsure of where to begin my research.

Any pointers in the right direction would be appreciated!

-Frank

For this you need Unity pro since you need RenderTextures

It’s possible to workaround that limitation in the Free version, but it has horrible performance as you would use Texture2D.ReadPixels.

edit

Well, you can get the effect of a RenderTexture with a script like this:

// C#
using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Camera))]
public class CustomRT : MonoBehaviour
{
    public Rect rect;
    public Material mat;
    Texture2D texture;
    void Start()
    {
        camera.pixelRect = rect;
        texture = new Texture2D((int)rect.width,(int)rect.height,TextureFormat.ARGB32,false);
        mat.mainTexture = texture;
    }
    
    void OnPostRender()
    {
        texture.ReadPixels(rect,0,0);
        texture.Apply();
    }
}

Do the following steps:

  • Attach the script to a second camera.
  • Change the camera’s depth to be rendered before your main camera
  • Create a material and assign it to the “mat” field
  • Choose a rect size for the RT. Note: You can’t use a larger size than your screen has!
  • Use the material on whatever geometry you like

The result looks like this:
webplayerExample

ps: I’ve added a link at the bottom to a UnityPackage which contains the example scene.