Shader-based fog without using volumetrics I need to create a scene with fog, i.e. distant elements faded out towards gray. I can't afford volumetric fog, because the renders would be way too slow. I'd like to just use a simple camera-to-object distance shader to interp the color toward mid-gray. I know that's not physically accurate but I think it'll be good enough for my needs.
I've seen how to do it with a depth pass and use that in the compositor, but I'm wondering if it can be done with a &quot;global shader&quot; right in the renderer?
I'm using Cycles in Blender 2.93, recent nightly.
You can use Ray Length (as suggested by @PGmath) to mix in a 'Fog Shader'.

Use Light Path &gt; Ray Length and Math &gt; Divide to control the spread
Use the result to mix your object's material with a 'Fog Shader'
Add a background plane with the same 'Fog Shader' (so they nicely blend together)

For the 'Fog Shader' set Specular = 0 (to have zero reflectivity)