Mixing Material Shaders Based on Light

In the quest to create a good-looking Earth, I’m experimenting with how to make the dark side of the sphere to use a “earth at night” texture. Is this possible in Cycles yet? My test case is a simple sphere with two different diffuse shaders (blue and orange) mixed together and a sun lamp shining on one side of it. I can’t find a way to make one side a solid color, the other side the other color, and a gradual falloff inbetween the two.

Thanks for that. So I guess the short answer is that it’s not really possible yet. Oh well.

Erm… Did you really read that thread thoroughly?
There are at least two possible solutions mentioned. And the last post even shows screenshots of the very same effect you want to create…?

Yeah, I read it. Sure it can be done through some driver fun, and I’m not dismissing its validity, but it’s yet another thing that BI can do that Cycles can’t. That’s mostly due to the fact that Cycles is still in heavy development, but it’s an interesting limitation. I wasn’t sure if it was possible, and now I know it…kinda is.

It isn’t impossible to achieve with pathtracers in general, after all the surface luminance node in Maya works with Arnold (thanks to a custom .dll you may get if you ask the people at SolidAngle kindly).


I tried to use the driver method and just didnt like it. It seemed too buggy at times. Also, teh day/night line just didnt look right. It was almost too much of a crescent.
The method I found that works best for me was to use another sphere on a seperate layer with just a white shader and use that in the compositor to mix the day/night sides together properly. You can set that layer so it only used 10-20 samples and it renders very fast.
My Earth modle consists of a Surface Sphere, Atmosphere/Cloud Sphere,Night Side Sphere, And a mask sphere to control the day/night mix in the compositor. Each of these are rendered on a separate layer. In the atmosphere/cloud sphere, I have another sphere teh same size of the surface sphere that has a holdout shader applied to it. It helps speed up the rendering of the atmosphere.
Here is an Earth model I just did.

another possibility, which works ok for atmospheres, is to add a Glossy with more than 0.5 roughness with a transparent shader.