Day / Night Planetary Shader

I’m trying to work out how to create a shader that shows a planet with day and night. The basic idea is to have one texture that is ‘daytime’ and shows the normal planetary features, and another texture for the nighttime lights. The night side of the planet should also be more blue and desaturated than the day side.

After much searching, I ended up using a tutorial by Clamps and the Strumpy Shader Editor:

http://forum.unity3d.com/threads/56180-Strumpy-Shader-Editor-4.0a-Massive-Improvements?p=431828&viewfull=1#post431828

I’m still working on fixing the nighttime lighting - figuring out how to take the amount of light on the surface and use it to adjust the emission for the nighttime lights, so they only appear on the dark side of the Earth (and then going a step further and blending in some blue/purple on the dark side for added realism). If anyone knows how to do that, please let me know, otherwise I’ll post back when I’ve figured it out.

You can just make a texture composed of dots for lights that goes over the whole planet. Then write a glow/emmisive shader that uses a dot product or normalize based on light direction and the texture as a glow/emmissive map. Just make sure that is made negative so that it occurs on the unlighted side.