First post on here in years…..
I wanted to get the sprite colour in Unity to be applied using a Photoshop style overlay layer mode.
I found this page here that lists the calculations for all the Photoshop blend modes
It has a cool space background as well which is a bonus.
Anyway. With that I created a new shader using the default sprite shader and used the following in the fragment shader.
c.r = (step(0.5f,c.r)*(1-(1-2*(c.r-0.5))*(1-IN.color.r))) + (step(c.r,0.5f)*(2*c.r)*IN.color.r);
c.g = (step(0.5f,c.g)*(1-(1-2*(c.g-0.5))*(1-IN.color.g))) + (step(c.g,0.5f)*(2*c.g)*IN.color.g);
c.b = (step(0.5f,c.b)*(1-(1-2*(c.b-0.5))*(1-IN.color.b))) + (step(c.b,0.5f)*(2*c.b)*IN.color.b);
c.rgb *= c.a;
With that you can create a grey scale image with highlights and shadows and tint it.