PDA

View Full Version : baking animation of many objects into one??


pfistar
01-27-2008, 12:34 AM
hello all

i'm facing the conundrum of taking a large array of procedurally animated objects - many of them 'instances' and baking them down into one large object so that i can apply a final WSM to it.

not even sure where to start.

bnvm
01-28-2008, 10:13 PM
I had to do a simular thing a while back but my objects had vertex animation on them. If you want to combine animated objects into a single object that basically means that you will have a single object with animated vertices to allow for the combined objects to move properly. If you have a lot of hires objects this will cause max to get very slow, however it would be possible to bake the vertex motion on the final object using a point cache. basically this is what you would need to do.

In my case I had a bunch of objects with vertex animation on them that needed to be unified into a single object. For each object I store the keyframe data for each vertex in the object, attach the object to a new poly object and reassign the keyframe data to the vertices, repeating this for each object. Afterwards I baked out the vertex animation to a point cache.

1.) create an empty editable poly - no verts or faces, using an editible poly will automatically transfere all mapping coordys / subobject materials correctly. I believe this is true, it has been a while since of have done this.

2.) Store the total number of vertices in the object to be attached.

3.) for every object get and store the vertex positions for all verts at every keyframe in the animation. Also get the in and out tangent types, you could just get the vert positions at every frame but this would greatly increase the number of keyframes on the animated vertices in the final model. Be sure to store the keyframe times as well. Depending the motion of the objects, you may have to store the vertex position at every frame.

4.) attach the object to the poly object that will be the unified object.

5.) When an object is attached the vertex order in the attached geo is retained it is simply added to the vertices that already exist in the object. For example, if the unified object already has 100 vertices and you attach an object with 50 vertices the corrosponding attached vertices would be from 101 to 151. Loop throught the vertices in the unified object starting with the first ATTACHED vertex to the last. In the case of the first object this will be vert #1 to the (total number of verts in the attached object). If it is not the first object attached it should be the (total number of verts in the unified object BEFORE THE OBJECT WAS ATTACHED + 1) to the (total # of verts in the unified object BEFORE THE OBJECT WAS ATTACHED + the total # of verts in the attached object + 1). The +1 may or may not be needed? While in the loop animate the vert positions using the data collected in step #3 be sure to set the in and out tangets as well if you are not setting keys at every frame. Repeat for all objects to attach.

6.) be sure to update the unified poly object after the loop is complete.

If the materials / texturemapping gets messed up you may need to store the texture vertices and reassign them in the loop, I don't think this will be needed though.

This process will be slow and the file could become very slow to work with, If you point cache out the vertex animation you will need to rebuild the unified object by simply attaching it to another empty edit poly object (after writing out the cache file) like before and reassigning the point cache modifier to it. Deleting the keyframes off of the unfied object will not delete the controllers on the vertices so the object would still be slow to work with.

I would definately experiment with booleans or something before resorting to this method. The nice thing about using this scripted method is it would allow you to unify a whole bunch of skinned characters into one object keeping all the deformations, you would probably need to store vertex data for every frame though.

Good luck.

-bnvm

Matt-Clark
01-30-2008, 11:58 AM
Clone the objects and attach them together.
Add a skin wrap to the newly attached object and add the original objects as a drivers, very low tolerance as geometry is identicle.
Point Cache the result.

pfistar
01-30-2008, 04:03 PM
Clone the objects and attach them together.
Add a skin wrap to the newly attached object and add the original objects as a drivers, very low tolerance as geometry is identicle.
Point Cache the result.

i haven't tried it out yet but this sound very smart and simple.
thanks mate!
npf

CGTalk Moderation
01-30-2008, 04:03 PM
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.