Inverse Lighting

I’m writing a shader for a planet. Part of the effect is the lights on the night side, kind of like the following image:
Image

My code so far is:

Shader "Earth" {
Properties {
	_Color ("Main Color", Color) = (1,1,1,1)
	_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {}
	_Illum ("Illumin (A)", 2D) = "white" {}
	_EmissionLM ("Emission (Lightmapper)", Float) = 0
}
SubShader {
	Tags { "RenderType"="Opaque" }
	LOD 200
	
CGPROGRAM
#pragma surface surf BlinnPhong

sampler2D _MainTex;
sampler2D _Illum;
float4 _Color;

struct Input {
	float2 uv_MainTex;
	float2 uv_Illum;
};

void surf (Input IN, inout SurfaceOutput o) {
	half4 tex = tex2D(_MainTex, IN.uv_MainTex);
	half4 c = tex * _Color;
	o.Albedo = c.rgb;
	o.Emission = c.rgb * tex2D(_Illum, IN.uv_Illum).a;
}
ENDCG
} 
FallBack "Self-Illumin/VertexLit"
}

I think it would be most effective if I could query the lighting from the scene, invert said property, and multiply it by the darker texture. Any suggestions on how to do that?

Thanks.

You could use a custom lighting function to do this in the deferred renderer. In the forward path, though, it’s more difficult because every light is added separately, and at no point does the shader have access to the summed irradiance.