Point Level Animation and OBJ Sequence
In game development character rigs are used to create character animation. This is the default solution for humanoid type characters. The character that i want to use (in mobile game development) has odd proportions and using a character rig didn’t seem to be the right.
- bake (track frame by frame) vertex or point level animation
- export to OBJ sequence and use the sequence in Unity game engine
Baking Point Level Animation (PLA)
The animation needed to become a “vertex animation” also referred to as “Point Level Animation”, a 3D sequence animated on the vertex or point level.
Baking (tracking) the animation frame by frame is a pretty straight forward action if you are using a polygonal object. I’m using Cinema4D and in Cinema4D it is not possible to bake deformers like Sub Division (C4D R18 also supports OpenSubDiv, Pixar has a lot of in-depth info on OpenSubDiv).
This is where the Xpresso node based editor comes in the picture.
Basically i used the correction deformer to get the index of the vertex information, and then passed this on to a polygonal object with the same amount of points. This is a polygonal object, so from here the point level animation could be tracked and baked.
Another challenge is export to a OBJ sequence, you can export to OBJ in C4D but there is no build in option for exporting a sequence of OBJ files. After some Google searches i found bits and pieces of Python scripts and after a bit of tweaking the following Python script worked for me on OS-X:
import c4d import os import subprocess from c4d import gui #Welcome to the world of Python def main(): # get active document doc = c4d.documents.GetActiveDocument() # retrieve an instance of render data renderSettings = doc.GetActiveRenderData() # retrieve fps docFps = 30 # Get Animation Length fromTime = 0 toTime = 82 animLength = toTime - fromTime + 1 # prompt user for directory filePath = c4d.storage.SaveDialog() filePath, objName = os.path.split(filePath) objName = objName + "_" filePath = filePath + "/" # Check for confirmation questionDialogText = "Obj Sequence will be saved as:n"\ "" + filePath + objName + "####.obj"\ "From frame " + str(fromTime) + " to " + str(toTime) + " for " + str(animLength) + " frames.\n" proceedBool = c4d.gui.QuestionDialog(questionDialogText) if proceedBool == True: # Loop through animation and export frames for x in range(0,animLength): # change frame, redraw view moveTime = c4d.BaseTime(fromTime,docFps) + c4d.BaseTime(x,docFps) doc.SetTime(moveTime) c4d.EventAdd(c4d.EVENT_FORCEREDRAW) c4d.DrawViews(c4d.DRAWFLAGS_FORCEFULLREDRAW) # progress bar c4d.StatusSetText("Exporting " + str(x) + " of " + str(animLength)) c4d.StatusSetBar(100.0*x/animLength) # add buffer 0001 bufferedNumber = str(doc.GetTime().GetFrame(docFps)) if len(bufferedNumber)<4: for x in range(len(bufferedNumber),4): bufferedNumber = "0" + bufferedNumber # save file fileName = filePath+objName+bufferedNumber+".obj" print fileName c4d.documents.SaveDocument(doc,fileName,c4d.SAVEDOCUMENTFLAGS_DONTADDTORECENTLIST,1030178) else: print "User directed cancel" c4d.StatusClear() if __name__=='__main__': main()