Script for baking animation for constrained objects?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2009   #1
Script for baking animation for constrained objects?

I have been fumbling around trying to find a way to bake out some animation I have on a camera. The camera is animated via three dummies in a hierarchy and I need to 'bake' in the animation at every keyframe in worldspace. Currently every method/script I have found bakes the animation in local space so when the dummies/point helpers have been deleted the camera does not retain any of the animation, yet I have a keyframes at every frame. Is there a way to create keyframes that would take the position/rotation of the camera in worldspace at everyframe and allow me to delete everything but the camera and retain all animation?

thanks in advance...
__________________
Joel LeLièvre
joel@divisionof8.com

www.divisionof8.com
www.delicatemachines.com
Vimeo Videos

 
Old 03 March 2009   #2
Hi,

to get you cam-animation baked you could download the attached macro-script, install and run it (it is in the category "MTools"). It is based on the "Align over Range"-Script which can be found on scriptspot.com - i modified it in this way that it is a rollout-floater instead of a utility and subframes can be sampled now, too, as well as I implemented undo.

Pick your camera as Source, create a new helper and select it as target, check the desired transformations and hit "Do it".

Afterwards you should remove all tranformation-keys from your camera (or a copy of it) and link it to the baked helper.


greetings,
Martin
Attached Files
File Type: zip MTools-AoR.zip (1.3 KB, 90 views)
 
Old 03 March 2009   #3
Originally Posted by Intrinsia: I have been fumbling around trying to find a way to bake out some animation I have on a camera. The camera is animated via three dummies in a hierarchy and I need to 'bake' in the animation at every keyframe in worldspace. Currently every method/script I have found bakes the animation in local space so when the dummies/point helpers have been deleted the camera does not retain any of the animation, yet I have a keyframes at every frame. Is there a way to create keyframes that would take the position/rotation of the camera in worldspace at everyframe and allow me to delete everything but the camera and retain all animation?

thanks in advance...


p = point()

for f = animationRange.start to animationRange.end do
(
with animate on
(
slidertime = f
p.transform = camera.transform
)
)

camera.pos.controller = bezier_position()
for f = animationRange.start to animationRange.end do
(
with animate on
(
slidertime = f
camera.transform = p.transform
)
)

delete p
__________________
Disclaimer: My opinions are not those of my employer.



Last edited by eek : 03 March 2009 at 09:36 PM.
 
Old 03 March 2009   #4
instead of transform you must use offset transform to get proper position if pivot is not on its original place

http://scriptspot.com/3ds-max/camera-io i did this script exactly for the cameras, you can export and after import camera and all will be ok
__________________
HEAVY METAL

Last edited by gasmasocet : 03 March 2009 at 03:54 PM.
 
Old 03 March 2009   #5
Originally Posted by gasmasocet: instead of transform you must use offset transform to get proper position if pivot is not on its original place

http://scriptspot.com/3ds-max/camera-io i did this script exactly for the cameras, you can export and after import camera and all will be ok


That shouldnt matter, as im transforming a point to the camera's current transform offset or not. It would only matter if i was making a new camera with an identity matrix, id have to get the relative space.
__________________
Disclaimer: My opinions are not those of my employer.



Last edited by eek : 03 March 2009 at 09:34 PM.
 
Old 03 March 2009   #6
Try to move the camera pivot and create e point from Camera.Transform.Position and you will se that it goes to pivot location not to Camera POINT OF VIEW POINT. This is what i ment, its rare case but happens
__________________
HEAVY METAL
 
Old 03 March 2009   #7
Originally Posted by gasmasocet: Try to move the camera pivot and create e point from Camera.Transform.Position and you will se that it goes to pivot location not to Camera POINT OF VIEW POINT. This is what i ment, its rare case but happens



I dont follow? Do you mean a target camera or a free camera, moving the pivot of the camera in both and creating a point to match the camera's transform will always result in the world transform of the camera node.transform multipled by its object-offset transform i.e its pivot.
__________________
Disclaimer: My opinions are not those of my employer.


 
Old 03 March 2009   #8
Create some camera and move the camera pivot somewhere away.
After that run those lines of script and you wil see the diference.

I ts very important to have it in mind when you do a camera calculations,
some times pivot is offseted and info is wrong. I personaly know several
people that do animated Orbit by offseting pivot.


-----THIS WILL GO TO PIVOT LOCATION

point pos:$Camera01.transform.position

-----THIS WILL GO TO CAMERA OPTICAL CENTER LOCATION

point pos:$Camera01.objecttransform.position




hellp explains it better:

A node's transform property contains the Node Transform Matrix, and reflects the position, rotation, and scale of the node's pivot point. Accessing the pivot property will return the same value as the pos property. Setting the pivot property will move the pivot point location to the specified coordinates, however the node's geometry will not be moved.
A node's objectoffsetpos, objectoffsetrot, and objectoffsetscale properties contain the component parts of the Object-Offset Transform Matrix. A node's objecttransform property contains the Object Transform Matrix. Since this matrix is a combination of the Node Transform and Object-Offset Transform Matrices, this property is read only. Note that these properties are always returned in the World coordinate system context.
__________________
HEAVY METAL

Last edited by gasmasocet : 03 March 2009 at 08:25 AM.
 
Old 03 March 2009   #9
You don't need the relative tranform offset if your transforming the same object by it's own space. Only if you make a new object with a different object space that needs to copy the same trasform relative to itself. For this you would you the (newObject * inverse oldObject)*oldObject

Also you can get the object.center for it's center

My last example explained this I was capturing the objects transform with a point and then transforming the same object minus any controllers using the points transform. I.e I made a reference transform space over time removed any constraints and re-transformed this object using this reference space.
__________________
Disclaimer: My opinions are not those of my employer.



Last edited by eek : 03 March 2009 at 10:53 PM.
 
Old 03 March 2009   #10
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 02:55 PM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.