How to correctly drive a normal node with lamp rotation?

I'm trying to use drivers to allow a lamp rotation to dictate the direction of my normal node. The problem seems to be that the sun can rotate from 0-360 degrees, but the driver has a limit of 0-90 degrees, so the rotations do not match up. Is there any way around this? Thanks!

This is a bit tricky, since the value range of the normal vector is (-1, 1). But you appears to control it by object rotation, which circle range is from 0° to 360°. It doesn't make any sense to add drivers between them.

You can use Mapping node to control the Normal vector output, driven by the object rotation (in degrees or radians). However, Blender internally uses Radians instead of Degrees, that's why you'll see the driver value shows in both radian and degree system.

So, you need to do some radian calculation for the driver expression. In this case, on the newly added Normal node (with the "control ball" UNTOUCHED), you need to add/subtract a half circle for it, which equals pi.

Example file:

• The file has been deleted. Could you please re-upload? Also the formula here is very small and I cannot read it. Apr 2, 2018 at 5:26
• @PierreSchiller It actually lost... I just re-made it for you. Apr 3, 2018 at 8:34
• Thank you so much. So now it's downloadable again? Also, If I rotate the empty, the normal shading on the ball will change. But what if I turn the ball away from the empty? Will it detect the change from its current position to the empty's position? Apr 3, 2018 at 13:23
• I didn't add the visual axis mesh, which was intended for better visualization only, but you can still reference the widget. The drivers just control by the rotation, regarless the distance or position. But I think you can do that with driver in a different setting. Apr 3, 2018 at 15:12
• Oh man, it broke. The file is not working on current Blender 2.79b (daily dev). Nov 7, 2018 at 21:20