Importing 3D Position Data from MATLAB Simulation

Scripting for After Effects

Importing 3D Position Data from MATLAB Simulation

Postby sina12345 on 02/22/2015, 7:59 pm


I'm going to be running a simulation in MATLAB for my math course. Specifically I'm planning on churning out 3D position vectors representing the motion of a particle over a certain period of time. My goal is to export these position vectors into after effects, hook it up to, say, a particle emitter, and then animate the results.

My question is, how would I need to have my 3D position vectors written out to be compatible with after effects? Is there a specific standard I should follow (I mean there has to be, but what is it?). A specific file type? Can I just have a .txt document where each line is a time point, and each column a value for x,y,z?

Lastly, I have another crude idea as to how I might do this. If I make a frame by frame animation (in MATLAB) of a dot that follows the motion I want to animate, then can I import that, track it, then do it that way. The only problem with that is, I don't know how to retain all 3D data when doing that. I suspect I'd end up with a 2D track. I could perhaps be clever and make my dot scale as it changes depth....but I'd like to know what other people think.

Hopefully my question has been concise.
Posts: 104
Joined: 05/17/2009, 11:25 pm
Location: Toronto, Canada

Re: Importing 3D Position Data from MATLAB Simulation

Postby star+circle on 05/1/2015, 4:25 am

AE keyframe data looks like this, so you need to format it accordingly. I've done something similar for 3D accelerometer data from raw output by formatting it in Excel, turning it into a text file and copying and pasting it to an AE null. Works fine. The measurements are in pixels, so you can use that to establish the output ranges.

Adobe After Effects 8.0 Keyframe Data

Units Per Second 25
Source Width 1920
Source Height 1080
Source Pixel Aspect Ratio 1
Comp Pixel Aspect Ratio 1

Transform Position
Frame X pixels Y pixels Z pixels
0 400 300 0
10 400 600 0

End of Keyframe Data

As for your tracking idea: For the z-axis data, can you render it out from MatLab in two views, say front and side and track both? That way you could extract the z axis from the second track.
Posts: 741
Joined: 12/6/2014, 3:07 pm
Location: Finland

Re: Importing 3D Position Data from MATLAB Simulation

Postby martinez86 on 05/7/2015, 8:59 pm

Thanks for these informations.
Posts: 1
Joined: 05/7/2015, 8:54 pm
System Specs: Element 3D nstalled

Return to After Effects Expressions