I know unity calculates exponential fog, but where does this happen?
I looked though all the CG includes including the lighting model one but couldn’t find anything.
The only reference I found was in HLSLSupport.cginc which has:
#define FOGC FOG
Which I assume is the fog color, but this isn’t actually used anywhere, not in the default lighting models or in CGInclude or anywhere else I looked. I guess the fogging is done with fixed function hardware and it’s hidden in some part of the engine code we don’t have access to?
Any chance that could change in the future?
Right now the only way I can see to implement alternative fog models is to:
- Re-write every shader

- Disable fog and use replacement shaders. Less
than #1 but expensive for fog so add some 
- Calculate fog in screen space using a depth texture. Less expensive than 2 but that kills AA or any 8-bit transparency blended materials so

Anyone had any other ideas about this?
Would be nice is the fogging was exposed to CG somehow (in a helper function lighting models can call) so that we could easily replace fog calculations system-wide.