View Full Version : MDD vertex key I/O Testing
Hello, Slw_sl wrote MDD (Lightwave) export and import for Blender and we'v worked together to get it running well in Blender.
The scripts are in the animation menu- files are import_mdd.py and export_mdd.py
The scripts can export/import any? mesh animations as a series of keys (like RVK's) and load the mesh animations in other software, or from other software into Blender.
Aparently Lightwave made the format but its quite generic.and could be usefull in many cases. even between blender<>blender
Youll need the latest blender from the CVS to test, but Id appretiate it if people could test import and export with software other then Blender.
Then we will have shiny working MDD support for the next release. :)
Some possibilities are to support static particle animation. and Im not sure weather softbodies works properly, but Iv mainy tried to get it working stabaly with basic examples walk cycles and keyframe animation.
So this would work for .md2 or .md3 export, or perhaps something like Poser morph targets?
nor sure about md2, md3, but MDD is like a series of morph targets all put together as an animation. so it should work for that.
I´ve send an e-mail to Ben Batt (modifier stuff!) asking to him if would be possible to add an "read .mdd" on modifier stack. This would be wonderfull!!!
Mdd is a lightwave MotionDesigner format for animation deform storage
. It is very popular among animators because is the exchange format
use by "PointOven" (http://www.ef9.com/ef9/PO.htm).
it could be a bless for animator exchanging their animations between
packages (eg, poser animated characters could be renderes in Blender!
Is quite easy to create a mdd file from Meshes exported from poser; or
maya animations inside Blender...)
More info about MDD Files (http://www.ef9.com/ef9/PO1.5/LW/PointOven_lw.html)
Mdd files are used by Point Oven to store deformation data. When an
MDD file is exported, Point Oven saves the position of every vertex on
the chosen mesh for every frame of the animation specified. Once
baked, the mesh can be stripped of all deformers and animation, and
have just the Point Oven MDD reader plugin applied. This will then
read the data for the specified frame and deform the mesh to the
For high resolution poly meshes this can be alot of data to read/write
and thus MDD files can be quite large, however, the Point Oven MDD
reader plugin only loads the data for the specified frame, minimising
memory requirements. The data is stored as binary for speed and
efficiency and thus can't be read in a text viewer.
*** MDD file format ***
The MDD file format is very simple and here is a brief description for
TD's and developers who are interested in adding tools to a pipeline
built around MDD.
The first thing to note is that the MDD file format is Motorola Big
Endian byte order as opposed to the Intel Little Endian standard. So
however you implement the structure below, you must come up with an
algorithm to flip the bytes during file IO.
The data structure is like so:
float *Times; //time for each frame
and the data is written like so:
I agree that a modifier would make for a better mdd reader, but for exporting I think that python does just fine, cambo gave alot of help in optimizing both the import and the export.The thing about reading perframe like point oven does is it makes for an anoying slow playback and scrub speed, However when it comes time to render you have that much more free ram for your renderer.
Cambo I have been thinking more on our conversation on irc about frame0, or the restPose, the best example I can think of would be that hand.blend in the tracker,
so after exporting the mdd and importing to the new mesh go into edit mode on the origonal mesh,
then do the same on the new mesh, notice the new mesh is using a deformed pose for editmode.
This is what the frame0 is for to store the undeformed verts, and we store deformed verts at this point, I think we actually miss one frame of animation as well (becuse of this).
anyway it works great on my end LightWave doesnt have a problem reading them at all, and blender reads the mdd files I feed it from Lightwave. :)
I have managed to write an mdd reader in plain C but looking at the modifier code
it doesnt look like one would have access to the file browser, and typing the name of your .mdd in a text field like the displace modifier would mean you would have to type in the whole path, still looking in to it though.
Ohh yeah one more thing if this script catches on and alot of people with other applications start to use it , There is going to be alot of requests for the current import/export scripts to Keep the origonal vert count and vert order, with the current import/export scripts this does not happen.
I have been testing the MDD file Import Export Scripts..
Fantastic work on this - It has Huge possibilities -
Export gives me an error in Blender 2.42a
File "<string>", line 73, in main
XSI to Blender workflow
-XSI Foundation 5.11 Trial has pointoven export..
-used collada export to transfer man model from XSI - imported .dae in Blender 2.42,
-Animated man in XSI and exported animation via point oven,
- imported .mdd file via python script to man in Blender -
Any ideas on the Error for the exporter?
Did some testing with Softimage - Importing models and animation for rendering in Blender -
Here is the result
Here is a link to the Quicktime MPEG4
During the Collada transfer of the Model, I encountered sizing issues with the different parts of the model - the scaling and transforms were not the same on oll the elements. I tried freezing, etc. In order to get a working export from XSI 5.11 trial which blender imported successfully, I disabled all the advanced exporting features in the XSI Collada export dialog - except for the "selected only" - The seleced only prevented me from exporting all the shape targets models in the XSI file (This file is part of the XSI tutorial package download). I did have to tell Blender where the UV image was for the face.. But all the mapping cam across fine as did object and texture naming. Worknig out of a common directory would probabaly make that reloading unneccesary.
When I Loaded the MDD data onto the head model in Blender, it resized and rotated 90 degrees around X axis - which actually made it correct for Blender. I had to scale the teeth and glasses to fit. I blelieve most of this could be overcome with proper setup in XSI prior to exporting. Much like clearing all rotations and such in Blender before parenting, etc...
Tested Blender Export - XSI Foundation 5.11 import of mdd data
Using the file driven_hand-mdd.blend with the the win32blender2210.exe build of Blender.
Exported hand using Collada - Imported in XSI using Collada.
Exported .mdd from Blender and imported in XSI Foundation 5.11
Note that the XSI importer for .mdd recognizes the frame rate that Blender exports. Make sure your frame rate on Export matches your destination frame rate. In my case I exported at 25fps and XSI was at 30fps. In XSI the animation finished early (25fps) instead of 30fps even though there are 59 frames..... it even shows the frame rate in the import dialog once you select the file... This would be a good tip for the instructions in the script...
The XSI mdd import appears to read the data from the file directly - it is instantaneous with no apparent load time. The XSI importer also allows you to set the imported data to Ping-pong or Loop...
Export gives me an error in Blender 2.42a
File "<string>", line 73, in main
AttributeError: typeideasman42 has been hard at work adding functionality to the python api and this script uses some newer features. Does this error still apear in a later build of blender?
I had to scale the teeth and glasses to fit.Im not familiar with the collada export yet but it sounds like the teeth and glasses were imported as seperate objects and the mdd was only for the head object. If you wanted to import a whole scene from xsi you could export an mdd file for every object in the scene and apply them in blender. This should work for objects without any animation as well(just for orientation and scale).
One thing to watch out for with MDD files are the size of the files. They can become quite large. Theres several mdd importers for LW that will load only the mdd data needed for that frame.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.