🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Is there other method than quaternion or rotation matrix to orient animate characters?

Started by
34 comments, last by taby 2 years ago

pengkuan said:

@frob

I will shut up with you.

To be clear, I wasn't saying you need to shut up, I was saying you need to prove your case. That's the only way a paper like that matters.

You made a bold claim that it is faster. That's your claim to prove, and your paper doesn't bear that out.

You need to show it side by side with actual metrics. Compare it against common implementations like DirectX Math, against the Intel Performance Primitives, against NVidia's CUTLASS library. Because unless you have numbers actually demonstrating it is faster than the other major implementations for the operations you're looking at, it doesn't show anything.

Before you have metrics it won't be taken seriously by anyone. After you have metrics everyone may take notice.

Advertisement

frob said:
Before you have metrics it won't be taken seriously by anyone. After you have metrics everyone may take notice.

What if he has no options to create such metrics?

At the moment, he's just sharing an idea. The bold claims may be made out of personal conviction, and now he may be baffled about our requests of proofing the shit out of his stuff, before we even look at it.
I can relate, if i remember what they have done to me, after registering at beyond3D and claiming GCN was 5 times faster than Kepler GPUs with Compute.
I've learned some guys take some things very serious, and request proofs about claims. And that's fine. But to me, initially, the reaction was totally unexpected. I was too naive to expect the obvious.

Imo, doing the metrics could be our job. If we have code, we can implement, optimize, compare it against our established libraries. But that's not yet important.

Likely we just need to read the code to judge performance, but also how it works and if it is useful. Which problems it solves, better or worse, or not.

Maybe i could figure out such code from spending a lot of time on the paper. But i do not really expect to learn something new about 3D rotations, so i'm not willing to spend this time.
And i think this is true for most people, and that's is the major problem some given code would solve: Showing the method clearly, so we know what to talk about.

pengkuan said:
one can use complex function which x and y at once using builtin function, which reduces the number of line of code

Does your argument reduce to “if complex multiplication is as cheap as scalar multiplication, then getting u and v out of a single multiplication is cheaper?"

That is a trivial observation, but it is also based on a false premise. Complex multiplication is no different from a matrix-based 2-matrix multiplication.

Rotating “the cross of the man" is no different from re-calculating the basis, and you still need to re-apply that basis when you actually want to render (or otherwise compute) with the vertices.

And “using a built in function to reduce lines of code” is a totally vacuous claim. You can make any operation “built in” with a single #include directive.

So, my evaluation of this has gone from “might be worth my time studying in detail if you can show some real results,” to “this is not actually new, it's just adding additional operations compared to normal math libraries and will thus run slower, while being less intuitive than reading the basis vectors directly from a matrix, or reading the axis/angle formulation of a quaternion.”

enum Bool { True, False, FileNotFound };

pengkuan said:
I’m not in game programming and I do not know code. So, I cannot provide code to show the thing. But I think that if in mathematics, we have fewer operations, in computing we will consume less time. So, I provide you with the formulae that show that there are fewer mathematical operations for computing rotation with my method.

Oh, i have missed this post yesterday with my former response, which was based on assumption you would be no programmer, eventually.
Fewer operations means less time in general, yes.

pengkuan said:
Let me explain the joined image of formulae. When computing using trigonometric function, we have to compute cosine and sine for the N+1 thetas.

I think you get this wrong. Figure one shows how to construct a rotation matrix from given Euler angles. But this does NOT mean we commonly use trig operations in combination with matrices, or rotations in general.
It is totally common to construct the basis vectors geometrically, avoiding expensive trig ops. One example is how to construct a ‘look at’ matrix, which seems to be the same (or a very similar) idea you propose in your paper.
If somebody has Euler angles data (which usually comes from human interface input, e.g. one animation curve for each angle), then there is no way around of using trig to convert this data into 3x3 matrix, quaternion, or even your custom 6 number representation of a rotation, i'm sure of.

But we don't do this at runtime. Instead we convert Euler angles and key frames e.g. into a sequence of quaternions as a preprocess, and that's the animation data we ship with our games. No more trig is needed when working with this final data.
What we do at runtime with rotations is mainly two things: 1. Rotate lots of points (e.g. vertices of a character) 2. Rotate orientations (e.g. upper leg frame also rotates lower leg and foot bones)
None of those tasks require trig, no matter if we use matrices or quaternions.
We also avoid trig in our runtime simulations, e.g. rigid body physics, ragdoll physics, vehicles, etc.

pengkuan said:
Edgar Malinovsky has shown that multiplication wins against trigonometric function. He computed using multiplication instead of trigonometric function to generate 3D fractals objects. He noticed a real acceleration of computation speed. The images of these objects are here as proof.

Ofc. avoiding trig is a huge win. But to say it clearly: Only beginners use trig in cases it could be avoided, if performance matters.
Early in your paper you propose the concept of ‘Mixed multiplications and mixed product’. To be honest, it almost looks like you have figured out something, and then you think it's a new invention?
It's not new. We all know and use this concept for ages. Some people see such concept as an application of trigonometry (while still avoiding expensive trig ops), others see it as a application of 2x2 matrix math, others see it a s application of complex numbers.
Does not matter, because the math is the exact same no matter how we call it. It also is trivial and obvious, which makes your attempt of presenting this as innovation looking a bit naive. It's fine to explain those trivial things, but giving them new names and presenting them as something new makes no good impression, imo.

pengkuan said:
I have forgotten to mention the rotation around the chest axis. This will make 3 rotations. But, the rotations around the head axis, arms axis and chest axis are more intuitive then Euler's rotations.

Call it x,y,z, or pitch, yaw, roll, or up, left right, or body, chest, stretched arms. The problem remains the same: We need a convention to perform those 3 rotations in specified order, thus we may need conversations between all conventions, and we perform 3 rotations instead just one.

I think it's easy to answer what is the most intuitive, regarding 3D rotations:

If we imagine orientation, we think about the cross visualizing the xyz axis. Because matrices contain those axis directly, matrices are the most intuitive way to represent orientation.

If we imagine rotation, we better avoid the hassle of dealing with multiple rotations in sequence, which gave us all those ‘gimbal lock problems’, coming from people failing to understand this concept in detail.
The easy way is to think of it as a single rotation around a given axis by a given angle. But given axis and angle, we can not work efficiently. So we rather prefer quaternions, because they are pretty close to the axis and angle concept.

So what i think is: It helps to differentiate orientation from rotations, just as much as it helps to differentiate points from vectors.

But that just said for the sake of discussion.

pengkuan said:
This is also an argument for complex multiplication because real and imaginary parts of a complex numbers are stored together. Fetching one complex number is less expensive than Fetching 2 real numbers. Complex number multiplication is surely more optimised than multiplication of 2 2D vectors.

The numbers in a matrix or quaternion are also stored in sequence, so that's no real argument for your method either. It's also just a technical low level detail, not really relevant when looking at the math.

Ok, that's quite some critique from all of us here, but you have to expect this after making claims of a new and better way to deal with 3D rotations.
I think you underestimated our experience on the subject of 3D rotations. What seems new ideas to you is daily practice to us.
Adding this to list of things you should eventually refine on the paper ; )

What's left is to look at your way to rotate a point, and how using 6 numbers affects the necessary instructions to do so.
Maybe i'll look it it in more detail later the day…

JoeJ said:
Maybe i'll look it it in more detail later the day…

Almost there… What i saw so far:

First you reinvent the conversation of Euler angles to basis vectors.
Same thing you criticize about matrices, yielding the same math and amount of trig ops.
(Btw, i do not accept your ‘complex numbers in N dimensions’ concept here either. You perform two 2D rotations in order, and deal with more numbers than 2, but this does not give us new algebra like quaternions, octonions, etc. did. Beside Euler angles conversations, we can see this same math in conversation from cartesian to spherical coordinates, for example. Though, i'm no mathematician and should / can not judge this.)

After that you propose an alternative using points to target at instead angles. So yes, you did reinvent construction of a look at transform.
Though, i think your way of getting there is not as intuitive as the look at. Some code to show typical construction as we are used to:

vec3 xAxis = normalize(targetPoint - objectCenter); // make unit vector pointing towards the target point
vec3 yAxis = normalize(upVector - xAxis * dot(xAxis, upVector)); // project a given upwards direction (to define roll, regarding your example) to the plane of xAxis to make it perpendicular
vec3 zAxis = cross(xAxis, yAxis); // cross product of two axis gives as the third

You should be able to read this. It really is as simple and intuitive as it can get. No need for angles or trig at all.

However, this is just one way of constructing orientation geometrically. It has nothing to do with rotations yet.

Will read the final part about rotating points later…

I bookmarked this a while back but I have not watched it. Seems like people that are all about math should know about it already but I don't see any references to it in the thread.

🙂🙂🙂🙂🙂<←The tone posse, ready for action.

@fleabay lol I was logging in just to share the same thing : ) https://marctenbosch.com/quaternions/

(for anyone else reading this, definitely check out the paper since it provides example source and analysis of the different methods (IIRC))

Wow. I have this bivectors, wedge products and stuff on my to-learn-list for years, but never got at it.
At some point, i tried to understand quaternions geometrically. And it worked for vector rotation, but trying the same for quaternion multiplication… i made some progress, but it was no success : )

Now i'm old and have accepted the black box. But it feels like coming back to all this might be worth it…

@JoeJ

First, I want to say that I have learned a lot from your posts and you are so kind. Thank you very much.

JoeJ said:
But we don't do this at runtime. Instead we convert Euler angles and key frames e.g. into a sequence of quaternions as a preprocess, and that's the animation data we ship with our games. No more trig is needed when working with this final data.

I did not know this. I came from sciences and in mathematics and physics they do lot of trigonometry. So, in Video Game you are not hindered by trigonometry. You have explained well about mixed multiplication, rotation. So, I let these things down .

JoeJ said:
What we do at runtime with rotations is mainly two things: 1. Rotate lots of points (e.g. vertices of a character) 2. Rotate orientations (e.g. upper leg frame also rotates lower leg and foot bones)

JoeJ said:
What's left is to look at your way to rotate a point, and how using 6 numbers affects the necessary instructions to do so.

When you rotate points at runtime, do you use quaternion multiplication like q*p*q^-1?

With the direction frame of my orientation system, I can rotate a point this way: new point= old point * [B], with B being a 3x3 matrix. I have put the formula in the joined image.

Let me explain the formulae.

Equation 10 is the vector around which we want to rotate a point. This vector is u.

In my system, I call it dx and express it with 4 numbers: a,b,d,f, which are cos and sin of the angles, I have put the expression of dx and a,b,d,f in the equation 11.

Let the point to be rotated be Xg=(xg,yg,zg)

The new point after the rotation is X1g=(x1g,y1g,z1g).

The new point is computed using equation 12, where the first matrix is the inverse of the last matrix. It happens that the inverse of the last matrix is its transpose. In the middle is the matrix of the rotation angle.

The three matrices are multiplied together and make the global rotation matrix [B] in the equation 13.

This way, the rotation of a point is done with the multiplication of the point by the matrix [B] in the equation 14.

I have put the rotation formula using quaternion in 14 for comparison.

My rotation system eq.13 uses 9 multiplications for rotating the point, with the 3 angles given: 2 direction angles and 1 rotation angle.

Using quaternion, eq. 14, because quaternion has 4 dimensions, for the same condition we need 4x3+4x4=12+16=28 multiplications to rotate the point. 4x3 for the first quaternion multiplication: q(xg,yg,zg), and 4x4 for the last. Quaternion multiplication (a1+a2i+a3j+a4k)(b1+b2i+b3j+b4k) gives 16 elements, which means 16 multiplications.

So, we could save 28-9=19 multiplications per point rotated at runtime.

I should be humble in claiming things here, so this number is for discussion.

JoeJ said:
(Btw, i do not accept your ‘complex numbers in N dimensions’ concept here either. You perform two 2D rotations in order, and deal with more numbers than 2, but this does not give us new algebra like quaternions, octonions, etc. did. Beside Euler angles conversations, we can see this same math in conversation from cartesian to spherical coordinates, for example. Though, i'm no mathematician and should / can not judge this.

3D complex number can be multiplied and divided, but which is not explained in the paper.

This topic is closed to new replies.

Advertisement