How to average a texture

I am trying to create a post processing material that pulls apart an image in to light, mid, and dark values, averages them then rebuilds it using the 3 color blend. The final effect is to be able to drop in an image with the color palette you want with minimal tweaks and have it applied to your scene.

Right now I am stuck on the averaging part, I believe the best way to do it is a custom HLSL node but i can not find any good tutorials and the ones I have found have made it more confusing.

The best way I have found to do this with out HLSL is using a TexCoord multiply by 0 but…

Unfortunately I can not do this after I have separated out the color values I need a way to average it from a lerp.

Is my best option HLSL? If so where is the best place to find a tutorial or guide to learn? Maybe converting the lerp to a texture object?

Any help is appreciated. Thank you

1 Like