Expressions used
Rotation X:
cp=thisComp.activeCamera.toWorld([0,0,0]);
sp=thisLayer.toWorld(effect("CC Sphere")("Offset"));
x=length([sp[0],sp[1]], [cp[0],cp[2]]);
y=cp[1]-sp[1];
alpha=Math.atan2(y,x);
value+radiansToDegrees(alpha);
Rotation Y:
cp=thisComp.activeCamera.toWorld([0,0,0]);
sp=thisLayer.toWorld(effect("CC Sphere")("Offset"));
x=cp[0]-sp[0];
y=sp[1]-cp[2];
beta=Math.atan2(y,x);
value+radiansToDegrees(beta) - 90;
Light Height:
campos=thisComp.activeCamera.toWorld([0,0,0]);
planetpos=thisLayer.toWorld(effect("CC Sphere")("Offset"));
sunpos=thisComp.layer("Sun").position;
camvector=normalize(campos-planetpos);
sunvector=normalize(sunpos-planetpos);
angle=Math.acos(dot(camvector, sunvector));
100 - (angle/Math.PI)*200
Light Direction:
thesun=thisComp.layer("Sun");
xy=thisLayer.fromWorld(thesun.position) - effect("CC Sphere")("Offset");
angle=Math.atan2(xy[1],xy[0]); radiansToDegrees(angle) + 90;