Step-by-step After Effects tutorial using only the included plugin. 
Part of the Makin' Planets tutorial series, this tutorial looks at how to use After Effects, expressions and the included plugin, CC Sphere to make Mercury in AE's 3D Space which responds to AE's lights and cameras correctly. 
We also look at how to add an atmosphere to Mercury. Mercury doesn't have an atmosphere, but this is a neat hack.
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;

You may also like

Back to Top