- Home /
Shaders: How do I make camera view transparent? (Image effect)
Hi, I have 2 cameras placed on the same positionand same rotation, but different Culling masks. I want to hide a part of the cameras' view so that I can use an texture to deside on what places on screen camera1's view is shown and on what screen positions/pixels camera2's view is shown. I tried to change the alpha of one camera's view, but that did not seem to work. This is my code:
//if shown according to texture
if (tex2D(_TexMap, i.uv).b < _Float)
return dot(tex2D(_MainTex, i.uv).rgb, float3(0.3, 0.59, 0.11)) * tex2D(_TexMap, i.uv) * tex2D(_Color, i.uv);
//if not shown according to texture
col.a = 0; //does not seem to work, what do i type here?
return col;
I hope someone could help me with code or some other tricks. Thanks, aWolfKing
Answer by HarshadK · Feb 17, 2017 at 11:50 AM
For col.a = 0
to work you need to set your shader's RenderType
to Transparent
.
Image effect shaders are the same type of shaders that are used on the objects.
Thanks for your help, but I could not achieve what I hoped I would :(
Your answer
Follow this Question
Related Questions
Use information from two cameras in one image effect shader? 1 Answer
Camera issue 5.3.2 image effects 3 Answers
Fade camera in/out using image effects shader 0 Answers
How to combine a camera rendering an edge detection image effect with another camera 1 Answer
Image Effect - Screen coordinates 1 Answer