In the old Blender Internal render engine, if I wanted to make a model of the Earth complete with city lights on the dark night-time side, I’d just add the color texture map (plus specular texture map etc) and a night-time city-lights texture set to emission. Which is still easy to do in Cycles
But to get that texture to only effect the night-time side of the earth model, in Blender internal, I’d just add a blend texture, tweak it, and set it’s mapping to the sun lamp, and set it to stencil out the texture. (see first image) so no mater how the Earth or the sun lamp are rotated, the blend texture always faced the way the sun is pointing, so it only blocked the city-lights texture on the lit side of the earth model.
I already now how I’d do most of this in Cycles, using a gradient texture set to multiply out the lights texture. But how would I map that gradient texture to my sun lamp, getting it to match it’s rotation despite whatever position of the Earth model?
Thanks in advance.