Does a shader exist in where distance = less saturation?

I’m wondering if a shader exists in where the farther back objects are drawn the less saturated their pixels are?

That should be relatively easy with a post effect

Nice, is that in the regular post processing effect profiler? My impression is that I would have to create a custom post effect.

If the question is “does this exist someplace?” Yes.

If the question is “does this exist someplace with the effects Unity provides?” No.

If the question is “does this exist someplace on the asset store that I can buy?” Maybe? I have no idea.

More than likely this would have to be written as a custom shader. It could be done as a custom shader you apply to the objects in your scene, or as a custom post process effect. Which one is better depends on your use case and platform. For mobile you absolutely want to do it on the object as post process effects are much more expensive. If it’s on desktop or console, either option is viable though a post process based effect will work on your existing opaque shaders. It won’t work on transparent objects, those will need a custom shader for sure.

As for writing a shader that does this, I can’t think of any examples off the top of my head that do exactly this, but there’s plenty of examples out there of shaders that do custom fog, or some other distance test from a point in the world or the camera. There’s also plenty of examples of how to desaturate a color value in a shader, the best ones convert the RGB color value to HSB/HSV and back, though there are cheaper options that look almost identical. It’d be a matter of combining the two to drive the saturation level based on the “fog” level.

1 Like

Thanks bgolus,

I’m looking up how to do fog in order to accomplish it. I think once I have a better understanding of that I’ll end up much closer to the solution. I’m not really concerned about the mobile part as I’m using only desktop/console gpus.