What would be the easiest way to base the alpha of a pixel on the green component of the texture color in a shader.
So any green parts of the texture are transparent, and the rest is left alone.
Solved it:
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent"}
void surf(Input IN, inout SurfaceOutput o) {
o.Albedo = tex2D(_MainTex, IN.uv_MainTex);
o.Alpha = 1 - tex2D(_MainTex, IN.uv_MainTex).g;
}
Don’t do 2 samples… just do 1 - o.Albedo.g
Hi, I am trying to do something very similar but lack any knowledge about shader programming. What I want is to use a .mp4 movie in a UI canvas and to make its background transparent. Such that for each pixel that is a given color, the shader will skip it.
Would it be possible to adapt the previous answer for my need? Also, it would be nice to have more context given as to the previous code sample, I have no idea how it fits inside of a .shader file.
Thanks.