Activity › Forums › Adobe After Effects › A new way to simulate “real 3D” in AE
-
A new way to simulate “real 3D” in AE
Posted by Erland Kjensli on October 28, 2007 at 9:07 pmHi. I have found a new way (I think) to simulate 3D in AE, which can be done with either a film clip and keying, or with a 3D-rendered clip with alpha channel. Take a look at a quick test movie I threw together:
https://www.tellusdata.no/head.mov
Is this interesting at all? Or is this just crap? Comments please… If interesting I can elaborate on the technique. ek(at)tellusdata.no
Erland Kjensli replied 18 years, 6 months ago 6 Members · 12 Replies -
12 Replies
-
Erland Kjensli
October 29, 2007 at 7:59 amThe “Kjenslifying” technique.
It’s a little comprehensive and takes a some preparation, so you be the judge of the pros and cons of this technique. Additionally, it’s not perfected yet. The expressions need a little tweaking to be perfect. And a lot of the code is hardcoded instead of using several of the intrinsic/native (?) functions of AE. This should be corrected so that it will be easier for people to adapt this to their own footage. If there is something in my project that doesn’t make sense, just mail me and I’ll explain it. Feel free to suggest changes and improvements.
Here goes. The point is to make a movie clip or a rendered animation that shows a rotation of an object. In many cases it will suffice with one rotation around the Y axis (following the XZ plane). If you make a footage like this, one should do it in front of a green “screen” to key out everything other than the object. Place the object (or person) on something that can rotate (a chair or something) and rotate it 360 degrees while recording. A more exact way to get an even rotation is to create an object in a 3D program like 3D studio max. Animate a rotation round the object, and render it out including the alpha channel. I used PNG-files and imported them as PNG-sequence in AE. The number of PNGs per rotation dictates how smooth the flow will be in the finished effect. I have created one project for rotating just around the Y axis, and one for rotating around all three axis. So when creating for just the Y axis, I used 249 frames (I think) to get the whole rotation.
First I’ll explain the Y axis only project. I have created 4 “walls” using a stars image 4 times, just to get a little space feeling. So that’s the 4 bottom layers in 3D. Then we have the footage containing the rotated object above those. On top I have the camera layer. All expressions are applied to the rotation footage only.
I use the “look_at” in the “Orientation”:
lookAt(position,thisComp.layer(“Camera 1”).transform.position)
As you know, this makes the footage always face the camera. Then I use Time >> Freeze Frame on the footage. In addition I enable time remapping on it as well.
I added a Slider Control to the footage, found in the
Effect >> Expression Controls >> Slider Control.I added expressions to this slider control, and it looks something like this:
———————————-
Add= 0;
Invert = 0;
Fx = transform.position[0];
Fz = transform.position[2];
Cx = thisComp.layer(“Camera 1”).transform.position[0];
Cz = thisComp.layer(“Camera 1”).transform.position[2];if ((Fx == Cx) && (Fz == Cz)) Angle = 0;
if ((Fx >= Cx) && (Fz > Cz)) {Add = 0; Invert = 1};
if ((Fx > Cx) && (Fz <= Cz)) {Add = 90; Invert = 0}; if ((Fx <= Cx) && (Fz < Cz)) {Add = 180; Invert = 1}; if ((Fx < Cx) && (Fz >= Cz)) {Add = 270; Invert = 0};x = Math.abs(Fx-Cx);
z = Math.abs(Fz-Cz);if ((x != 0) && (z != 0)) {
Angle = radiansToDegrees(Math.atan(z/x));
} else {
Angle = 0;
}if (Invert == 1) {
TotAngle = Add + (90-Angle);
} else {
TotAngle = Add + Angle;
}linear(TotAngle, 0, 360, 0, 10)
———————————-This computes the angle between the footage position and the camera position on the XZ plane around the Y axis. The inverted TAN function only works from 0 to 90 degrees so I have to make it check which quadrant of the circle it is in, and then add 0, 90, 180 and 270 degrees accordingly.
The last line (linear) converts the absolute angle to the TIME OF THE FOOTAGE. So 0 to 360 degrees converts to 0 to 10 seconds.
Then in the Time Remap of the footage I add this expression:
effect(“Slider Control”)(“Slider”)
This then gets the time value and shows the correct frame from the footage.
Voila! 360 degrees rotation around an object in AE. This effect will work mainly if you stay close to the XZ plane and don’t travel too far up or down Y. But in many cases this will be enough for some really cool effects.
Now for the total rotation. Now it will be a little too complicated to shoot film containing an object shown from 360x360x360 degrees. So I created a rendering in a 3D program of a head rotating 360 degrees XZ as above, only with just 89 frames all around (should have been 90, just a glitch). Then I changed the angle 5 degrees up and rendered again. After up and down I ended up with 360 degree rotation seen from 37 angles. This results in lots of frames.
You will find the code for this project in a link further down. It’s similar to the first project, but we have to compute the angle between the XZ plane and the camera as well. And then add 89 frames to the footage time for each 5 degrees elevated. Get it? Sorry if this is a little confusing, but download the projects (7MB and 47MB) and take a look.
It all needs a little cleaning up in there, and a few math functions should be replaced with AE functions.
Feel free to comment on this or suggest changes and rewrites.
https://www.tellusdata.no/KjenslifyingXZ.rar
https://www.tellusdata.no/KjenslifyingXYZ.rarErland Kjensli
(Alan Chenslee)
Norway -
Mike Derk
October 29, 2007 at 3:02 pmI couldn’t get your movie to play. But there was no error message… maybe your bandwidth was exceeded?
-
Darby Edelen
October 29, 2007 at 3:34 pmFor future consideration, try compressing your QuickTime movs with streaming “Fast Start” enabled. I’d comment on the technique, but the movie has been loading with no preview for the past 3 minutes.
=O
Darby Edelen
DVD Menu Artist
Left Coast Digital
Aptos, CA -
Darby Edelen
October 29, 2007 at 3:40 pm[Erland Kjensli] ”
This computes the angle between the footage position and the camera position on the XZ plane around the Y axis. The inverted TAN function only works from 0 to 90 degrees so I have to make it check which quadrant of the circle it is in, and then add 0, 90, 180 and 270 degrees accordingly.”Math.atan2(y, x) takes 2 parameters and returns the arc tangent of them properly regardless of what quadrant they lie in. Depending on your application there may be an angle offset that you’ll need to add.
Darby Edelen
DVD Menu Artist
Left Coast Digital
Aptos, CA -
Erland Kjensli
October 30, 2007 at 8:29 amAfter my new discovery of QTVR .mov-files this technique will be a breeze.
Reply to this Discussion! Login or Sign Up