How do you get a rendertexture with the camera's alpha onto a GUItexture?

I am looking for the most efficient way to:

  • Camera-render 3Dtext in front of a semi-transparent background polygon,
  • Bake this to a properly transparent texture and
  • Apply it into a GUItexture all at runtime.

Its easy to get a non-transparent camera rendering to a GUItexture. But none of the Clear Flags settings are providing the right result or they result in texture garbage. And if I used Texture2D.ReadPixels() as described in this Answer, how would I get the result to the GUI?

Done a lot of careful searching on forums and Answers, but no answers to this specific question.

Here’s an example screenshot of what I’m attempting. This is just a mocked up Photoshop file used as a GUItexture. I want to be able to build these question text objects dynamically, so I’m attempting to use a rendertexture from a camera that shoots the 3Dtext for the questions in front of their transparent poly backgrounds.

Just to ilustrate the GUI possibilities, I created a simple scene using alpha blended DrawTexture:

I don’t have Pro, so I’ve never used RenderTexture, but I read in the docs you can alocate a render texture (GetTemporary) which I suppose is off-screen. Could it be assigned to a Texture2D variable? If this is possible, you may use it in a DrawTexture and set GUI.color.a to control its transparency, like I did in my script, and GUI.depth to set the order. The simple test scripts Question.js and Wallpaper.js are listed below.


var pointer: Texture2D;
var backgd: Texture2D;
var style: GUIStyle;
var alpha: float = 0.7;

function OnGUI(){

	GUI.depth = 1;
	GUI.color.a = alpha;
	GUI.DrawTexture(Rect(40, 20, 300, 50), backgd);
	GUI.DrawTexture(Rect(25, 30, 15, 30), pointer);
	GUI.color.a = 1;
	style.fontSize = 12;
	GUI.Label(Rect(40, 20, 300, 50), "Generic question about something", style);


var wallpaper: Texture2D;
var alpha: float = 1;

function OnGUI(){

	GUI.depth = 2;
	GUI.color.a = alpha;
	GUI.DrawTexture(Rect(0, 0, 256, 256), wallpaper);