Pin&Drag IK and Java->C++ considerations



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 14/06/2007 at 13:55, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R8.2-R10 
    Platform:   Windows  ; Mac  ;  Mac OSX  ; 
    Language(s) :     C++  ;

    ---------
    I really like the type of IK that DAZ|Studio employs in the form of 'Power Pose'. From my excursions into learning about IK solvers, I found out that this is based upon Yamane-Nakamura's Full-Body IK system which is generally known as 'Pin-and-Drag' or 'Pin & Drag'. I'm not going to read their paper and try to implement the maths (which get complicated - matrix Singular Value Decomposition and so on).

    Actual code algorithms for this are even more sparse than CCD IK. I've only found one - in the open-source 'Art of Illusion' application. Ah, but it is Java and there are some conversion complications associated with going from Java to C++. For one, Java is always exception enabled whereas I'd not use it with the C4D SDK at all. That shouldn't be too much work to remove exceptions for some other error handling interface (like the one that I already use). A big one here is that Java arrays have basic features that C++ doesn't support such as A.length where A is an any-dimensional array and length returns the dimension. Of course, Java supports GC so all allocated memory will need to be literally deallocated in C++. This is just a cursory overview of the code and it is assured that other conversion issues may crop up during the process.

    The code is commented well, but there is a lot of code and it depends upon JAMA (Java Matrix) and of course standard Java interfaces (util, math, etc.).

    There are two pleas here:

    1. Can anyone provide assistance in developing this form of IK? And by anyone, I'm particularly talking to Maxon tech support. :)

    2. Any good references/links to robust Java->C++ code conversion procedures?

    Thank you very much,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/06/2007 at 01:11, xxxxxxxx wrote:

    Don't waste any time with CCD IK, the results are just poor (none optimal). Anything that doesn't try and calculate an optimal pose is going to give poor animation and is harder to animate.

    You are going in the right direction looking into jama. SVD is straightforward to use, just think of it as a blackbox you put data in and get useful data out of.

    If you've not already done so look up jacobian based IK systems. A google for jacobian IK is enough to throw up some references.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/06/2007 at 09:57, xxxxxxxx wrote:

    Interesting. I've read a lot about both CCD and Jacobian and was led to believe that the latter was just too calculation intensive for real-time work (user interaction in Cinema 4D, for instance). Do you happen to know what Cinema 4D 'hard' IK uses for IK solutions?

    I just wish C++ had variable multi-dimensional arrays like Java. Every instance of (and there are a few) :

    double[][] X = new double[m][n];
    

    has to be converted to:

    double* X = (double* )GeAlloc(sizeof(double)*m*n);
    

    As you can see, I'm not going to get fancy with allocating row pointers and then column arrays - too much cleanup work under error conditions and so on. I just do a complex indexing into the linear array to simulate a two-dimensional one: X[(i*n)+j].

    And since C++ doesn't have 'auto-exceptions' (exceptions like memory allocation exceptions that are automatically thrown) and GC, I have to check and free carefully.

    Well, at least I'm heading in the right direction. :)

    Thank you very much,



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 15/06/2007 at 11:10, xxxxxxxx wrote:

    Yes I do know, but I can't say too much without breaching nda.

    I've spent time researching and testing many IK solvers and ccd was generally poor. The various jacobian IK solvers do need a little more computation than ccd in simple cases but it depends on the chain and goal. Often ccd will not quickly converge and even when it does the result can be awkward with the animator needing limits to get a good pose. Look at the svd based solvers, these have good convergence.



  • THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

    On 16/07/2007 at 18:25, xxxxxxxx wrote:

    Back on this topic:

    Has anyone any experience with implementing a Pin&Drag; IK solver and interface?

    I'm trying to retrofit Art of Illusion's system to use as mine but it is terse (at best). As noted, Java has some facilities that C++ doesn't have natively (GC, auto array expansion, et al). Basically flying blind through the conversion process (Java->C++ and AoI to C4D IPP).

    For instance, right off the bat, AoI uses a Joint set for a skeleton hierarchy. Joints in turn use a CoordinateSystem (origin and orientation). One of the first things is that the Joint origin is acquired. I can only assume that this is the origin in relation to the global system (the global position) and not the parent but the comments don't make that very clear. I also assume that BaseObject->GetMg().off would be equivalent. Correct?

    I hate flying solo into unknown territory. Always lost and afraid. I am quite ready to request and pay for assistance - actually it has been hoped for some time to get another developer onboard as partner to quicken the development pace.

    Help! and Thanks!


Log in to reply