THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 01/02/2006 at 07:23, xxxxxxxx wrote:
Cinema 4D Version: XL 7
Platform: Windows ;
Language(s) : C.O.F.F.E.E ;
Hello out there everybody,
I am trying to develope a BVH-export-plugin fpr Cinema 4d XL7 in C.O.F.F.E.E. to export a skeleton-animation into poser (5). I found some docs about bvh-format and some example-sources in python for a bvh-export (I think it was made for Maya). I learned that bvh-files do need a different euler-rotation-order than used in Cinema and found a source, where this order is calculated from XYZ-order. I am nearly done except for the problem, that in Poser's BVH-files the rotaion-order differs between the channels (depending on where the bodypart is pointing to, parallel to x-axis/y-axis or z-axis).
So my question: Is this necessary and if yes, why does bvh need the channelinformation then? It seems not to work properly if I always set the rotaions-order in the hierarchy-section of all parts to XYZ or any other.
From the documentation of BVH I got the info (if I was not mistaken), that the rotational data is given as euler-rotations (like HPB in Cinema).
So there should be no need to recalculate them but if I do not my skeletion is wrapped like a burito after reimporting it to cinema :).
Does anybody have experiences on creating bvh-files and could give me a hint? Perhaps anybody has seen a bvh-export-plugin for Cinema I did not find?
And last, but not least: In earlier versions of Cinema the bvh-import seems to have been done by a seperate plugin. I do not have this anymore in my version but it would be really helpfull to take a look at its source.
So if anyone has the source /the plugin I would be gratefull to get it (if this does not violate any license, of course), just to see, what conversions are done to the rotational-data from the motion-section for import. (I assume that I will have to do the inverse process for exporting then).
Thanks for your help everybody,
PS: I will release this as open-source if it works, so there is no possibility to get money from it.
On 01/02/2006 at 11:13, xxxxxxxx wrote:
1. Yes, Poser uses ordered-axial-rotations for each 'body part'. There are six combinations: XYZ, XZY, YXZ, YZX, ZXY, and ZYX. If no twist/joint channels are specified, the rotate channels are used to determine the ordering. By default (if no twist/joint/rotate channels), the order is ZYX. If you look at a Poser-exported BVH, you will see that these are specified for each and every body part as CHANNELS.
2. One must remember the differences between Euler angles and C4D HPB:
a. H represents a general Y-axis rotation, P a general X-axis rotation, B a general Z-axis rotation. I say general since values are interpolated between (see c.).
b. When you get a rotation vector, vector.x = H, vector.y = P, vector.z = B. Therefore, x is not an X-axis rotation as one might assume.
c. Rotation on a single axis is not fixed to that axis. You will note that as you rotate one axis and then another and another, all of the rotation values are affected. This is how C4D avoids singularities (gimbal lock).
On 02/02/2006 at 06:17, xxxxxxxx wrote:
thanks, first of all, for your help. If I understood you right (sorry if this is silly but I am still a newbie ), I will have to change the rotation-order in the hierarchy-section like poser does. Second, if I got you right, is to recalculate the HPB-rotations to "real" axis-rotations, regarding the rotation-order from the channels-section. c.) Is clear to me now, caus if rotate one axis, of course the position of other axis is changed to.
If I understood right, I will have to take the rotated object at a frame and then try to extract the real euler-rotations of each axis from HPB at that time or is there a function returning/converting from a HPB-vector the Euler angles?
If there is not, do you think there will be a possibilty to calculate the real angels, perhaps by using the axis-vector from the local matrix and calculate the angles between each local axis and the world axis to get the corresponding euler-angle? I found a posting from Zeph about converting the rotational order of euler angles here in the forum. I will try this out.
Your answer was really very helpfull, I understand much better now, what causes the errors. If you have more tipps for me I'll be grateful!
Thanks a lot,