- Home /
Question by
saied63 · Oct 27, 2012 at 06:45 AM ·
cameraalphabackgroundrender texture
how to hide background from this shader ?
hello. i use this script for my camera to show alpha channel in render texture . but i dont want to show camera background . is there any way . thank you
var alpha = 1.0;
private var mat : Material;
function Start ()
{
mat = new Material(
"Shader \"Hidden/Clear Alpha\" {" +
"Properties { _Alpha(\"Alpha\", Float)=1.0 } " +
"SubShader {" +
" Pass {" +
" ZTest Always Cull Off ZWrite Off" +
" ColorMask A" +
" SetTexture [_Dummy] {" +
" constantColor(0,0,0,[_Alpha]) combine constant }" +
" }" +
"}" +
"}"
);
}
function OnPostRender()
{
GL.PushMatrix();
GL.LoadOrtho();
mat.SetFloat( "_Alpha", alpha );
mat.SetPass(0);
GL.Begin( GL.QUADS );
GL.Vertex3( 0, 0, 0.1 );
GL.Vertex3( 1, 0, 0.1 );
GL.Vertex3( 1, 1, 0.1 );
GL.Vertex3( 0, 1, 0.1 );
GL.End();
GL.PopMatrix();
}
Comment
Your answer
Follow this Question
Related Questions
(C#)Changing Camera Background Via Code 1 Answer
How to move the background in unity2d for ios game 0 Answers
Possible to Output Render Texture or Camera Output to Multiple Displays? 0 Answers
Change the background color attribute of a camera in C#? 2 Answers
How can I take depth into account when rendering to texture? 2 Answers