erleben / OpenTissue

OpenTissue is a collection of generic algorithms and data structures for rapid development of interactive modeling and simulation.
http://www.opentissue.org
97 stars 26 forks source link

Cal3Ds cfg-format to OpenTissue #31

Open ChristianLa91 opened 3 years ago

ChristianLa91 commented 3 years ago

How do you convert Cal3Ds cfg-format to a xml-format readable by OpenTissue?

Sincerely, Christian Larsson

erleben commented 3 years ago

We do not currently have this functionality.

I one had to do this then I would guess that one would need to write a cfg file reader and then call appropriate read/write functions on the caf/csf files reference herein, or their xml counterparts xsf or xaf. We have the read/write functionality for skeleton files but are missing the write-xml part for animation data. Details below.

Kenny


We currently only have io-import routines from Cal3D animation xml-format:

https://github.com/erleben/OpenTissue/blob/master/OpenTissue/kinematics/animation/io/animation_keyframe_animation_cal3d_xml_read.h

And our own home-brewed XML format

https://github.com/erleben/OpenTissue/blob/master/OpenTissue/kinematics/animation/io/animation_keyframe_animation_xml_read.h

The data structures are pretty flat and straightforward. For our usage, we just read in the raw data we never need to actually convert the data. So a write-xml function was never created.

The io routines I linked above can serve as boiler plates for a conversion tool. One would have to add a "write xml" function that would do the opposite of the read xml function.

This was done for the skeleton data, so here it is easy to convert by reading in and then writing afterward

https://github.com/erleben/OpenTissue/blob/master/OpenTissue/kinematics/skeleton/io/skeleton_cal3d_xml_read.h https://github.com/erleben/OpenTissue/blob/master/OpenTissue/kinematics/skeleton/io/skeleton_xml_write.h https://github.com/erleben/OpenTissue/blob/master/OpenTissue/kinematics/skeleton/io/skeleton_xml_read.h

As can be seen in our character demo we do not use a cfg file, we just read in the raw parts manually

https://github.com/erleben/OpenTissue/blob/master/demos/glut/character_animation/src/application.cpp

Hope this helps.

ChristianLa91 commented 3 years ago

Hi! Yes, I have become a little accustomed to the files that the character animation demo uses by now (and quite a big part of the engine) -- and have studied all the files you've mentioned (besides the skeleton_xml_write.h, because we don't need the ability to write our model to files for now). I've also studied the contents of the cfg-files (and all the other model-files). I have now looked into the Cal3D documentation and there it says that it exists a format for the skeleton called "xsf" that is a raw xml format with the skeleton data. Is this is the format that OpenTissue can read in animation_keyframe_animation_cal3d_xml_read.h? Sadly I haven't got Cal3D to work so I'm not able to convert the csf-files into xsf ones on my computer.

erleben commented 3 years ago

Yes as I recall it is for the xsf files.

@mortenengell perhaps you have more details on this?