I wat trying GlobalFog from StandardAssets.ImageEffect but it didn’t work on my customized vert/frag shaders. Some other built-in shaders like Unlit/Color and Unlit/Texture also didn’t work.
I modified GlobalFog.shader to check if the depthTexture is doing its job and it results in all white with customized shader.
Scene

Depth w/ built-in Standard shader

Depth w/ customized shader

I know here’s another option for fog, I was just trying another way around.
Here’s the custom shader.
Adding #pragma multi_compile_fog and marcos like UNITY_APPLY_FOG didn’t change anything in this case. I must missed something …
Shader "Custom/Opaque/NoLit" {
Properties {
_MainTex ("Diffuse (RGB)", 2D) = "white" {}
_ColorEnhance ("Color", Color) = (0,0,0,1)
}
SubShader {
Pass{
Tags { "Queue"="Geometry" "LightMode" = "ForwardBase" "RenderType"="Opaque"}
Blend Off
LOD 80
CGPROGRAM
#pragma vertex vs
#pragma fragment fs
#pragma multi_compile_fwdbase
#pragma skip_variants SHADOWS_SCREEN SHADOWS_NATIVE DIRLIGHTMAP_COMBINED DIRLIGHTMAP_SEPARATE VERTEXLIGHT_ON
#include "UnityCG.cginc"
#pragma target 3.0
sampler2D _MainTex;
half4 _MainTex_ST;
fixed4 _ColorEnhance;
struct VSInput {
float4 pos : POSITION0;
half4 uv_MainTex: TEXCOORD0;
};
struct FSInput {
float4 pos : SV_POSITION;
half2 uv_MainTex: TEXCOORD0;
};
FSInput vs(VSInput input)
{
FSInput output;
output.pos = mul(UNITY_MATRIX_MVP, input.pos);
output.uv_MainTex = TRANSFORM_TEX(input.uv_MainTex, _MainTex);
return output;
}
fixed4 fs(FSInput input) : COLOR
{
return tex2D(_MainTex, input.uv_MainTex) + _ColorEnhance;
}
ENDCG
}
}
FallBack "Unlit/Texture"
}