So I'm trying to do some shader work and I want use one color variable for two things: I want it to blend with the texture based on the "intensity" of the color, and I want the alpha of the color to blend the entirety of the image.
So:
fixed4(tex.rgb * (1 - intensity) + color.rgb * (intensity), tex.a * color.a)
Now my idea is to use the highest RGB value of color for it's intensity. using color.a is more intuitive, but since I want to use that for the transparency of the entire object, this doesn't work.
So the question now is, how do I get intensity?
Comparing RGB individually seems clumsy. That would be:
r > b > g?
And result in this uglyness:
max(r, max(g, b) )
Is there a better solution?