1. The curves represent values versus time (eg x vs. t, y vs. t, z vs. t, angle vs. t). Blender indeed ensures the the Bezier curves are a proper functions.
Originally Posted by sthomas
If that's meant to be a graph of x vs. t, then it's wrong to allow the tangents to be moved in 2-dimensions.
As I said in my second post, I am of course aware that there are some 2-D Bezier curves which would not make sense in this context. However, I still see absolutely nothing wrong with it. Artists should have the power to define nice curves and it is up to the programmer to worry about the math.

Anyway, it is not up to us to decide. I downloaded free version of Maya and it seems to handle animations the same way as Blender. I do not have Max, but I guess it will do it the same way as well.

EDIT: Note that strictly speaking there is nothing wrong with the Collada specification itself - it mentions the in-tangents and out-tangents, but it does not define their format (as far as I know).

2. However, I still see absolutely nothing wrong with it.
I have to disagree with that. I've seen other animation packages define * vs. t curves in that way as well, but strictly speaking it isn't correct, assuming that t is meant to be an independent variable used for parametric curves. One way to think about it is that if you have a function x = f(t), e.g. as in a Bezier curve, then the tangent dx/dt is a scalar value, but Blender allows you to manipulate the tangent point in 2-dimensions. That doesn't make sense because the tangent points don't have their own independent t-values that you can change at will.

So when you export to Collada, you'll need to cut down the dimensionality of those tangent points. Blender will also have to do this internally anyway in order to interpolate properly. This really has nothing to do with Collada and it isn't Collada's job to define how this is done.

EDIT: Note that strictly speaking there is nothing wrong with the Collada specification itself - it mentions the in-tangents and out-tangents, but it does not define their format (as far as I know).
Just to be clear, the tangents need to be the same dimensionality as the control points, otherwise the math doesn't work out.

3. Originally Posted by sthomas
assuming that t is meant to be an independent variable used for parametric curves.
Ah, I think this is the main problem - 't' is not the independent variable for the parametric curve - 't' is independent variable for the animation function (eg x=f(t) ), which is defined by the parametric curve. The independent variable for the parametric curve is then some arbitrary variable, say s, ranging from 0 to 1.

It is all about how complex the function f(t) can be. Linear interpolation is limited to 'f(t) = a*t + b'. The 1-D tangent interpolation is limited to functions of form 'f(t) = a*t^3 + b*t^2 + c*t + d'. However, the 2-D tangent interpolation can express much more complex functions - eg 'f(t) = sqrt(t)' - this is why it is used by most DCCs.

It is important to recognize that the 2-D parametric curve is not the final function f(t) - you need to convert the 2-D parametric curve P(s) to the function f(t). I can try to explain it if you do not know how to do that.

Originally Posted by sthomas
One way to think about it is that if you have a function x = f(t), e.g. as in a Bezier curve, then the tangent dx/dt is a scalar value, but Blender allows you to manipulate the tangent point in 2-dimensions. That doesn't make sense because the tangent points don't have their own independent t-values that you can change at will.
I do not really follow, do you mean you do not know how to get dx/dt (a scalar) for a function 'f' defined by 2-dimensional parametric curve? Remember that independent variable of 'f' is not the same as independent variable of the parametric curve. I can explain it a bit more if it makes no sense.

Originally Posted by sthomas
you'll need to cut down the dimensionality of those tangent points. Blender will also have to do this internally anyway in order to interpolate properly.
I am certain that this is not the case. Observed animation does follow the 2-D curve, not simplified 1-D one - you can see this easily in extreme cases.
Note that you can properly interpolate along 2-D Bezier curve. The math is more difficult, but it is not a rocket science.

Originally Posted by sthomas
Just to be clear, the tangents need to be the same dimensionality as the control points, otherwise the math doesn't work out.
Indeed. The two dimensional start and end control points are defined by (time, value) pair.

4. Originally Posted by dsrbecky
Ah, I think this is the main problem - 't' is not the independent variable for the parametric curve - 't' is independent variable for the animation function (eg x=f(t) ), which is defined by the parametric curve. The independent variable for the parametric curve is then some arbitrary variable, say s, ranging from 0 to 1.
Yup, I think that's exactly it. I was assuming t was the independent variable of the parametric curve (it usually is), but that clearly can't be the case in the figures you showed if the horizontal axis is t.

Ok, so I want to see if I can pin down exactly what Blender is doing. Let's just consider x animating over time for now. Blender allows for manipulation of a curve P(s) = [t(s), x(s)], where P is a cubic Bezier curve, and hence t(s) and x(s) are cubic polynomials of s, i.e. t(s) = a*s^3 + b*s^2 + c*s + d. However we're not concerned with looking up values of x given s, we want to find values of x given t. So somehow Blender must be able to take a t value and find the corresponding x.

It is important to recognize that the 2-D parametric curve is not the final function f(t) - you need to convert the 2-D parametric curve P(s) to the function f(t). I can try to explain it if you do not know how to do that.
Yes, can you show me how to get an analytic function x = f(t) based on P(s)?

However, the 2-D tangent interpolation can express much more complex functions - eg 'f(t) = sqrt(t)' - this is why it is used by most DCCs.
Can you show me how P(s) as defined above can be used to express x = sqrt(t)?

5. Originally Posted by sthomas
Yes, can you show me how to get an analytic function x = f(t) based on P(s)?
I see how this would be done computationally. Since t(s) is a cubic polynomial of s, then you can solve the cubic equation for a particular t-value to get 3 possible s-values, only one of which should be real as long as the curve is shaped properly. Then you plug this s into x(s) to get x. The confusing thing to me is what dx/dt looks like.

Collada's Bezier curves follow the more standard textbook definition and don't involve solving cubic equations and such, so I guess they don't match perfectly the curves as defined in the DCC tools. If you want you can write Blender-style Bezier curves (i.e. P(s) curves as defined above) to a Collada document and interpret the data that way, however it won't match Collada's definition of what the curve is (which is explained in the animation chapter of the Collada book), and other programs that read your data won't interpret it as you intended.

I don't see why the DCC tools do the P(s) thing anyway... I'm not convinced it gets you significantly more flexibility when designing a curve. It seems to me that just moving the tangents in one dimension (assuming the control points are 1d) gives you plenty of freedom and makes the math work out more naturally.

6. Originally Posted by sthomas
Ok, so I want to see if I can pin down exactly what Blender is doing. Let's just consider x animating over time for now. Blender allows for manipulation of a curve P(s) = [t(s), x(s)], where P is a cubic Bezier curve, and hence t(s) and x(s) are cubic polynomials of s, i.e. t(s) = a*s^3 + b*s^2 + c*s + d.
That's all correct.
NB: We are saying Blender, but the same applies to most DCCs.

Originally Posted by sthomas
So somehow Blender must be able to take a t value and find the corresponding x.
As you said, a cubic equation needs to be solved to find 's' - http://en.wikipedia.org/wiki/Cubic_equation (I guess that in practice some numerical method can be effective)

Originally Posted by sthomas
Can you show me how P(s) as defined above can be used to express x = sqrt(t)?
General solution for evaluating one dimensional Bezier curve:
S= (s^3, s^2, s, 1 ) // “Independent variable 's' of the curve” (row vector)
M = (-1 3 -3 1, 3 -6 3 0, -3 3 0 0, 1 0 0 0) // Bezier basis matrix
C = (p1, p2, p3, p4)^T // Scalar control points (column vector)
D = M * C // Coefficients of the polynomial (column vector)
x(s) = S * D // Definition of the function x(s)

It follows that
C = M^-1 * D // where M^-1 is the matrix inverse of Bezier basis matrix

The consequence is that for a given set of polynomial coefficients(D) we can calculate control points(C).

Now, let's consider x = sqrt(t) between t=0 and t=1. It can be expressed by the following parametric curve:
P(s) = [t(s), x(s)]
t = s^2
x = s
where 0 <= s <= 1

That is, defining Dt as “D subscript t”:
Dt = (0, 1, 0, 0) // 0*s^3 + 1*s^2 + 0*s + 0
Dx = (0, 0, 1, 0) // 0*s^3 + 0*s^2 + 1*s + 0
Ct = M^-1 * Dt = (0, 0, 1/3, 1)
Cx = M^-1 * Dx = (0, 1/3, 2/3, 1)

In other words, the four control points of x = sqrt(t) are:
P1 = [0, 0]
P2 = [0, 1/3]
P3 = [1/3, 2/3]
P4 = [1, 1]

NB: I find this neat. However, all this can be done without any matrix math by solving simultaneous equations.

Originally Posted by sthomas
The confusing thing to me is what dx/dt looks like.
It does not matter how the function is defined. dx/dt can still be obtained from the direction of a geometrical tangent at a given point.
For the 2-D parametric curve, dx/dt is simply (dx/ds)/(dt/ds). Take the x=sqrt(t) for example:
t = s^2
x = s
dt/ds = 2s
dx/ds = 1
Therefore dx/dt = (dx/ds)/(dt/ds) = 1 / 2s = 1/(2*sqrt(t))

You can try to differentiate x=sqrt(t) directly:
x = sqrt(t)
x = t^(1/2)
x = (1/2) * t^(-1/2)
x = (1/2) * 1/(sqrt(t))
x = 1/(2*sqrt(t))
as before

Originally Posted by sthomas
I don't see why the DCC tools do the P(s) thing anyway... I'm not convinced it gets you significantly more flexibility when designing a curve.
First, since all major DCCs do that this way, I am not really questioning it.

Second, I am not an artist, so I can not honestly tell whether it is worth it, but I can say as a mathematician that given enough keyframes, linear interpolation is sufficient.

Originally Posted by sthomas
however it won't match Collada's definition
I believe that the tangents are not actually defined in the specification at all. I guess what I am saying is that the lack of definition in the specification have let people interpret the tangents in a incorrect way (scalar) and I would like to see it explicitly defined the correct way (vector).
Here, I am using the word 'correct' to describe what seems to be a standard in professional animation. Whether it is mathematically simple, intuitive or meaningful is a question of personal preference.

7. Originally Posted by dsrbecky
I believe that the tangents are not actually defined in the specification at all.
But it's not just a matter of how the tangents are defined, it's how the math to actually interpolate is defined. Currently the math is defined in the Collada book (why isn't it in the spec?) as involving a few matrix multiplies to evaluate a standard Bezier curve. You want the math changed to solving a cubic equation to find the independent variable s that yields a given t, and then using s to interpolate the parametric curve to get x. It's really more than just whether the tangent is a scalar or a vector.

So there's a discrepancy between Collada's definition and what the DCC tools are doing. Some data will have to be tossed out when converting to Collada. I'm not sure how much of an impact this has. You should try creating some goofy curves that you can't create with standard 1d Bezier interpolation (like x = sqrt(t)) and see what happens when they get exported to Collada and then imported back into the DCC tool. Are the curves drastically different? I wonder what Remi and Marcus think about this, or if they are even aware of the issue.

Thanks for the discussion though. I learned a lot about how the DCC tools handle animation curves... I had never played with them myself.

8. Originally Posted by sthomas
You should try creating some goofy curves that you can't create with standard 1d Bezier interpolation and see what happens
Observation 1:
If you animate both the parent node and its child, the simplification can make the difference between object being stationary and moving across the screen:

Parent: P1=[0,0] P2=[1,1] P3=[2,1] P4=[3,0]
Child: P1=[0,0] P2=[3,-3] P3=[0,-3] P4=[3,0]

After simplification* the child will be P1=[0,0] P2=[1,-1] P3=[2,-1] P4=[3,0] which is exactly opposite of parent's movement and thus it will make the object stop.

This is of course unrealistic extreme case.

(*) Using algorithm that keeps dx/dt unchanged. Any other algorithm can be exploited in the same way.

Observation 2:
2D Bezier curve can be exactly expressed as 1D one iff its control points are equally spaced in horizontal direction. (ie t(s) is a linear function)

Originally Posted by sthomas
So there's a discrepancy between Collada's definition and what the DCC tools are doing. Some data will have to be tossed out when converting to Collada.

I wonder what Remi and Marcus think about this, or if they are even aware of the issue.
I am also curious what Remi and Marcus think.

Thank you very much for a constructive discussion. I have enjoyed it.

9. Originally Posted by dsrbecky
Originally Posted by sthomas
however it won't match Collada's definition
I believe that the tangents are not actually defined in the specification at all. I guess what I am saying is that the lack of definition in the specification have let people interpret the tangents in a incorrect way (scalar) and I would like to see it explicitly defined the correct way (vector).
Here, I am using the word 'correct' to describe what seems to be a standard in professional animation. Whether it is mathematically simple, intuitive or meaningful is a question of personal preference.
This has been a great discussion and I think you have summed things up very well with this statement. The definition of tangents you are asking for needs to be added to the specification. To this end, Remi has reported this topic as a bug in bugzilla.

http://www.khronos.org/bugzilla/show_bug.cgi?id=23

It would be good to add any important comments there so that we don't loose track of any details that implementors need clarification on.

Thanks.

10. Yes, the spec need to be more precise (and the book fixed)
But, without waiting for this, like all sources in COLLADA, tangents can be of any dimension.

For instance, a 1D tangent, that is most common as of today from the DCC tools (and wont be able to represent the differences in the curves you have posted) is using:

Code :
```<source id='tangent'>
<float_array id="tangent-array"> ... </float_array>
<technique_common>
<accessor count=".." source="#tangent-array">
<param name="ANGLE" type="float" />
</accessor>
</technique_common>
</source>```

For 2D tangent, here's what you need to do:

Code :
```<source id='tangent'>
<float_array id="tangent-array"> ... </float_array>
<technique_common>
<accessor count=".." source="#tangent-array">
<param name="X" type="float" />
<param name="Y" type="float" />
</accessor>
</technique_common>
</source>```

Page 3 of 4 First 1234 Last

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•