Dynamic Earth Day to Night in Cycles
To create a dynamic day to night transition for Earth or any other planet in Cycles, we’ll need to get the rotation data of the sun and plug that into the normal value of the sphere.
We can do this pretty easily by adding drivers to a mapping node between the input geometry node and the normal node. Here’s how to set up the drivers for each of the X, Y, and Z rotation values:
- Use the Sun as the Transform Channel variable object
- Set the Transform Channel type to the corresponding X, Y, or Z rotation
- Use the variable name as the scripted expression
- To convert the radians back into degrees correctly, add pi to the variable
- Flip the variable for X and Z by using a negative sign and parenthesis