Tinting the screen a certain color (Image Effect)

Hey everyone.

I’m after an Image Effect script that allows you to specify a color and tints the entire screen - something like a hue / saturation effect in Photoshop.

The default Image Effects have things like grayscale and sepia. I imagine it would be similar to them. If I use this color tint shader that I’m after and give it a golden color, it should basically look similar to the sepia shader. Giving it white should do nothing.

Can anybody provide me with this shader? Surely many others would be using a similar thing.

Cheers :>

Just take the grayscale effect and multiply the outcome with the desired color.

Could you possibly give me an example if it is as simple as you say?

I’m completely illiterate when it comes to shader writing

In that case – one of the built-in color correction image-effects lets you do per-channel adjustments which should be fine for what you need.

Standard tinting without grayscale:

o.Albedo = o.Albedo * fixed3(1.05, 0.95, 0.95); // for light reddish tint, or could use 0.95,0.95,1.05 for blueish etc.

To take the grayscale of a color:

o.Albedo = (o.Albedo.r + o.Albedo.g + o.Albedo.b) / 3.0;

Should be possible to combine both to get what you’re after.

I’ve got a working solution with the help of a a co-worker. One grays the image first and the other doesn’t.

The first is the equivalent of adjusting the Hue of an image in Photoshop with the Color box ticked, and the other with the box unticked.

I’ll post the working version once I’ve cleaned it up a bit (I’ve modified some base files to get this solution). I’ll also give @metaleap’s post a shot and see what happens.

Thank you for your responses.

Generally speaking, people use the luminance-preserving (for sRGB) formula:

Y = R*0.2126 + G*0.7152 + B*0.0722

+1 – this is obviously the superior approach, mine was the classic quick-hack “poor-mans” approach… :smile:

I’m actually using this, which I think might be the same thing:

return Luminance(tex2D(_MainTex, i.uv[1]).rgb) * color;