Discussions about spline ik



  • Hello,
    I rewritten spline ik due to some requirements, but I was stuck on the problem of rotation. I have tried to use up interpolation or spline trail, but there will still be their own problems. I also searched a lot paper, but did not find a clear solution, do you have any good ideas,or are these papers recommended?

    welcome any ideas



  • Hi @chuanzhen, thanks for reaching out us.

    Although the topic is not strictly related to Cinema 4D plugin development can you please elaborate more on what's the "problem of rotation" you're referring to and what you mean by "up interpolation" or "spline trail"? This will avoid the whole community to do useless guess work and maybe provide based on your context better suggestions.

    Cheers, R



  • Are you talking about constructing a series of frames along a spline? At least that is what I get from your question. I assume you are using parallel transport (what you seem to call up-interpolation) to construct the frames and ran into the banking problem that comes with that task in general and the PTF algorithm in particular (what you are referring to as rotation).

    Unfortunately there is no easy answer or fix to this problem, as there is no mathematical foundation for that what humans would consider a "logical" set of frames for a spline.

    As you also talked about papers, you probably already found Rotation Minimizing Frames, which is the common solution for the shortcomings of PTF, but also a bit more involved. Could you elaborate on where you are stuck?



  • @r_gigante @zipit
    The detailed explanation is shown below
    “up interpolattion”
    reback_01.png
    reback_02.png
    Try use "spline trail"
    reback_03.png

    I read some papers, but always been very slow, just only expanded know, such as Frenet–Serret formulas etc. But I did not directly find a better way to replace my current method, and I have been looking for it.

    Computation of Rotation Minimizing Frames This seems to be a good paper, I will read it carefully.



  • Hi,

    1. As suspected, the method you are describing is usually called Parallel Transpport (the geometric problem in mathematics in general) or Parallel Transport Frame (PTF, the specific algorithm in Computer Graphics to use Parallel Transport to construct a smooth series of frames).
    2. Just to be clear, as your image, you apparently put a lot of effort into, is not clear on that point for me: In PTF you construct the first component of the first frame in your series with an up-vector and the tangent of that element. For all other frames you use instead the component of the previous frame that replaced that up-vector in the first frame (i.e. the parallel transport part of the algorithm). Or as python style pseudo code for clarity:
    # With a hypothetical type 'Frame' which has the attributes i, j, k
    # for the components of a frame.
    tangents = get_tangents()
    frames = []
    
    for n, t in enumerate(tangents):
        # Select our 'up vector' based on n.
        up_vec = SOME_UP_VECTOR if n is 0 else frames[n - 1].j
        # This is the vector we construct diffrently based on wether
        # we are constructing the zerost or nth (n != 0) element.
        temp = up_vec x t
        
        i = normalize(temp x t)
        j = normalize(i x t)
        k = normalize(i x j)
        
        frames.append(Frame(i, j, k))
    
    1. I am still unclear on what you would consider wrong about your results. There are ways to adjust PTF sets for the banking problem (by smoothing the banking of the frames after they have been constructed for example) and RMF is very similar to PTF, with the major difference being that it also looks ahead and not only back. However both aPTF and RMF are normally only needed when you have closed splines (the first and last frame won't fit then with standard PTF) or you have drastic changes of tangency in the set of line segments, the spline, you are interpolating over. The results of aPTF and RMF should be very similar or identical to what is shown in your image (unless I am overlooking a problem here).
    2. As you seem to aim for replicating Cinema's results: I might be wrong, as I cannot find it at the moment, but I think I have seen that Cinema does expose its PTF algorithm somewhere in the C++ SDK. Again, I might be wrong and mixing up SDKs here.

    edit: Ah, I see now the marked problem in the second image. It is rather hard to just judge that from looking at an image, but at first glance I cannot see a reason, why a standard PTF should fail on that spline (as there are no drastic changes in tagency in your spline and its not closed either). You should double check your algorithm. If things remain unclear, check the PTF link I have posted above. However, be aware, that most cases "drastic tangency change" cannot properly be solved with PTF or a naive implemenation of aPTF that just smoothes the banking of your frames.

    edit2: What I was probably also unclear about, is the term "banking problem". It refers to the orientation of your frames along the axis of tangency, i.e. what you call "rotation".

    Cheers,
    zipit



  • @zipit Thank you for your patient reply, it really helped me a lot. I need to learn about PTF,This is a new point of knowledge for me, and I need some time to understand how it works. I will update the progress of the solution here.
    Yes,rotation is banking ,in my method it points to the next object in the chain of objects,not use tangent



  • @chuanzhen said in Discussions about spline ik:

    in my method it points to the next object in the chain of objects,not use tangent

    I am not quite sure how you mean that, but to be clear: If you have a chain of objects, i.e. an array of line segments, then the vector from the position of the current 'object' to the position of the next 'object' is the tangent of the line segment array at that point. Or in other words: The tangents in my example above are the vectors from the point n to the point n+1 in the list of points of a segementized spline.

    Cheers
    zipit



  • @zipit Hi, I came back a bit late.
    I read the paper and watched the video. The video is understandable and the paper is still obscure. The effect of Parallel Transport is similar to some functions of c4d python utils.SplineHelp ().
    The Parallel Transport method is useful, but using the control object to control the rotation of the joint (rotate around z) is still a bit unclear (in the picture below). The paper seems to mention some solutions such as (Animating rotation with quaternion curves) and (Fiber bundle twist reduction.)
    reback_04.png



  • @chuanzhen said in Discussions about spline ik:

    I read the paper and watched the video. The video is understandable and the paper is still obscure.

    Which paper are you referring to? The RMF paper? It has a chunk of pseudo-code you can straight up copy.

    The Parallel Transport method is useful, but using the control object to control the rotation of the joint (rotate around z) is still a bit unclear (in the picture below).

    I am still unclear on what is intended on what is not in your pictures. Is the twisting motion of your chain of objects intended or not? It would probably be best, if you just would generate an image of what your algorithm currently gives you and then create a second image, where you have fiddled your objects by hand into the orientation, you want them to have.

    The paper seems to mention some solutions such as (Animating rotation with quaternion curves) and (Fiber bundle twist reduction.)

    I am still not sure which paper you are talking about. There are other algorithms, especially a lot of hacks for PTF, but at least I would say that RMF will give you the best results, while being relatively simple, and PTF (or a naive version of aPTF like shown in the video) will give you good results, while being very simple. You have also to keep in mind that these all are hacks, i.e. algorithms for imitating what humans would consider an aesthetical set of frames placed on a curve. In reality the normals and bi-normals of a curve will flip based on the tangency of that curve.

    Cheers,
    zipit



  • @zipit Thanks,this paper Parallel Transport Approach to Curve Framing
    I will follow your suggestion to explore RMF. It may be that the language barrier prevents us from communicating well, but I still get a lot of help from your answer. I use Google translate😊


Log in to reply