ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to Accurately Translate "Angle" to 3D

COW Forums : Video Copilot

VIEW ALL   •   PRINT
Michael Schnyer
Expression to Accurately Translate "Angle" to 3D
on Sep 15, 2009 at 5:25:57 am

Hi guys, well first up, my dilemma: I am trying to create a 3D introductory sequence for a film I'm making. In the sequence, a title is shown over a backdrop (it is 2D, but has the AE Bump Maps that Mister Kramer posted a tutorial about on VideoCopilot).
Anyway, the text itself is of course 2D, but I wanted to create a shadow effect that would DYNAMICALLY react to a point light that will be moving throughout the scene.
Now, I have created a long shadow with the use of CC Radial Blur, a handy expression from Mister Kramer that translates a 2D coordinate to 3D (i.e., the point light), and an expression I found in these very forums, seen at bottom.

This expression works just fine with the Radial Blur and the effect is quite nice. However, I also wanted a softer, general shadow and an emboss effect to indicate a more "3D" text, so I changed the Layer Style to "Bevel and Emboss" in the hopes that the above expression would allow me to track the light point dynamically as well.
Herein lies my problem: when applying the code to the "Angle" parameter of "Bevel and Emboss," the Y axis works like a charm; however, the X axis is reversed. When the point light moves to the left the shadow also moves to the left, and when the point light moves to the right the shadows follows it instead of retreating from it.
Can this be fixed with a modification to the expression, or with a new one?
Also, there is a secondary issue: the shadow does not shift dynamically as the point light passes over the entire text, it shifts only as the point light crosses over the letter 'O' in the word "Origin". I will post a picture to illustrate my point (the point light is circled in green). Is this fixable as well?
I know very little about expressions at this point and would love to learn more. Please help me with this if you can, and thanks in advance!






l = thisComp.layer("Light");
p1 = l.toComp(l.toWorld([0,0,0]));
p2 = toComp(l.anchorPoint);
v = normalize(p2 - p1);
radiansToDegrees(Math.atan2(v[1],v[0]));


Michael Schnyer
Aspiring Filmmaker and Editor
Canon XH-A1
After Effects
Premier Pro
3DS Max


Return to posts index

VIEW ALL   •   PRINT
© 2019 CreativeCOW.net All Rights Reserved
[TOP]