Basically I’m taking a camera and overlaying it upon the main camera. I need to be able to set everything white (and it’s grey shades) to transparent. Ideally this would also have greys become partially transparent of solid black.
Mask
Base
Basically I’m taking a camera and overlaying it upon the main camera. I need to be able to set everything white (and it’s grey shades) to transparent. Ideally this would also have greys become partially transparent of solid black.
Mask
Base
Here’s just one quick and dirty way to do it. There are other fancier ways such as using post processing on the overlay camera, or using a custom shaders for the renderers in your overlay camera view. This method will do what you described by only adding a Quad to your scene.
fixed4 col = tex2D(_MainTex, i.uv)–this is the color that is sampled from the main texture for a given pixel.col.a = 1 - col.rgb;–this sets the alpha value to the inverse of the brightness (red x green x blue) of the color.col.rgb = 0; --this makes the color 100% black. Since the gray tones will already be blended in partially, you want to use a solid black color to be blended in.Blend One OneMinusSrcAlpha --this will tell the shader to blend with whatever colors have already been drawn behind it.Now you should see the output of your overlay camera rendering to the quad with the transparent effect.