Suppose I have a texture, what I want to do is for each pixel, return only the biggest channel as 1 and the rest as 0.
For instance:
| INPUT | OUTPUT
------|-------------------------|-----------------
RGBA | (0.5, 0.3, 0.4, 0.3) | (1, 0, 0, 0)
RGBA | ( 0 , 0.8, 0.9, 1 ) | (0, 0, 0, 1)
I'm using shader graph and I'm searching for an optimal approach to avoid using a lot of nodes.
My thought was taking the maximum m of all channels, then let each channel ci = (ci >= m), so the channel greater equal to m would be 1 and the rest would be 0, but I'm guessing there might be a better/more performant way.
PS: If there are 2 or more channels with the same value, the correctness doesn't matter, is a problem of the texture. It's possible to suppose there will always be a channel with biggest value.