Note: You must be registered in order to post a reply.
|
cbx |
Posted - Mar 31 2003 : 2:46:30 PM What the (explitive deleted) is a Quaternion any way? I understand the x,y,z part but what could the w possible be for? Mabe if someone explained it to me I might decide to start using it, since I have seen it kicking aroung since DirectX7.
Just thought I'd ask. |
Eric Coleman |
Posted - Apr 10 2003 : 10:40:31 PM Blending between two Euler orientations is simply interpolating between the matrices. v' = (M1 * (1-t) + M2 * t) * v Where M1 and M2 represent the two orienatation matrices, v and v' are vectors, and t is a scalar. This is just basic alpha blending; the two matrices are blended using a scalar alpha value. You should look at the quaternion example in the SDK. It shows the transition between two orientations using quaternion slerp. slerp stands for spherical linear interpolation.
As I've said before, you don't need to use quaternions in a 3D game. If you don't feel comfortable with them, then there really is no need to use them other than for very special purposes. |
cbx |
Posted - Apr 10 2003 : 12:07:01 PM Could you explain Euler interpolation? Are you refering to linear interpolation when you say this?
I am going to write some test code to try and proove you wrong about lerp, and gimble-lock, because I don't believe that is correct! |
Eric Coleman |
Posted - Apr 10 2003 : 01:26:04 AM Gimble lock is when a rotation cancels out another rotation, effectively removing a degree of freedom. If you do a 90 degree rotation along the X axis, then a 90 degree rotation around the Y axis, then you have gimble lock when trying to rotate around the Z axis because the Z is now the same thing as the X.
Lerp, aka interpolation, can be done with anything. When interpolating between two rotation matrices, the Euler interpolation creates intermediate orientations that are not the shortest path between the beginning and ending orientation. This makes the transition ugly. The quaternion path between two orientations is always the shortest path along a great circle joining those two orientations. |
cbx |
Posted - Apr 09 2003 : 11:05:00 PM Just what was gimble-lock again? Was'nt it somthing about rotations that strayed from there expected path slightly?
Another thing. Is it not true that gimble lock is irrelavant in games because the matrix that stores the rotation result gets rebuilt with the updated rotations before every rendering is done?
And one last thing ... quote: One of the nice things about quaternions is that you can interpolate between orientations smoothly, ...
... you can do that with D3D also ala Vector3.Lerp (DX9) or D3DXVec3Lerp (DX8) can't you?
|
Eric Coleman |
Posted - Apr 09 2003 : 11:24:39 AM You can also use the "axis-angle" approach, which avoids gimbal lock. You would use a single axis and angle to perform the transformation. One of the nice things about quaternions is that you can interpolate between orientations smoothly, which is wonderfull for things like skeletal animation. Another power of quaternions is that you can extract the the angle of rotation very easily. To do the same thing with Euler angles is pretty much guess work because ArcSin and ArcCos only have a 180 degree range.
Of course, as you have demonstrated, if you know about gimbal lock, then you can design things to avoid it. |
SteveUCI |
Posted - Apr 09 2003 : 02:57:50 AM It was my understanding that the advantage of quaternions was that you can avoid gimble lock which is the "problem" that comes about when you try to rotate around more than 1 axis away from the origin.
I once worked on a little galaxy simulation (who hasn't) and rotating my view from the origin was basically as simple as rotating around the 3 axes in succession.... however once I moved away from the origin, doing that same viewpoint rotation around the 3 axes proved very problematic (hard to describe, but the results were not what was expected).
Now I haven't tried any other approaches since then (it was a long time ago when I did rotations manually in cod -- perhaps if I did what 3D hardware now does and translate the entire world toward the origin before applying viewpoint rotations it would work), but I seem to remember finding out that I had to learn about quaternions to get around the problem I was running into.
Since then, instead of learning about quaternions, I simply resigned to rotating around only the vertical axis as I moved about 3d space.
Am I way off? |
cbx |
Posted - Apr 02 2003 : 3:02:47 PM After browsing through the game dev fourms regarding Diana Gruber's "Do We Really Need Quaternions?" article It reminded me of a paragraph in her article ...
quote: Believe it or not, the quaternion vs. vector debate goes back more than 100 years. Quaternions were developed by William Rowan Hamilton around 1843 and immediately took their place in mathematical history as a solution in search of a problem. In 1901, just two years before his death, a Yale professor named Josiah Willard Gibbs published a treatise on vector algebra which included a definition of the vector dot product and vector cross product. Vector algebra was put forth as a simple, robust alternative to quaternions. Egos erupted, tempers flared, and the debate raged. Gibbs' vectors were championed posthumously by his colleague, Edwin B. Wilson, along with Oliver Heaviside in England. Quaternions were defended by Peter Guthrie Tait, but it was a losing battle. Vector algebra triumphed over its non-Euclidean predecessor, and the popularity of quaternions faded.
... The fact the the human race has been arguing about vectors verses quaternions for over 100 years is a testament to how much we humans just love to squable. |
cbx |
Posted - Apr 02 2003 : 2:40:39 PM No eric, no! Your runining it for me! I thought I was done with those dam quaternions, then you come along and debunk her article. Arrraahhh! Why could you not leave me to my blissfull ignorence!
As for why I am sticking to my vectors and matricies any way? Because I use Direct3D to render my graphics. And it does not matter what kind of math you use to do rotations it all gets converted and stored into a matrix. And it gets storted in a matrix because that is the only relavent data type that the direct3d pipline is designed for. Weather you use quaternions or vectors for rotations, the results all get stored inside of a matrix! |
Eric Coleman |
Posted - Apr 02 2003 : 12:01:23 PM AT, I fixed that big long URL you posted. It seems the google url causes the forum's automatic url recognition to go crazy. The url works now
cbx, if you look at the "articles and reference" section at Gamedev.net, you would have found the quaternion information. Here is a link to the quaternion articles. gamedev quaternion link
As for quoting the Diana Gruber article, you have been mislead. Diana Gruber doesn't know a damn thing about quaternions, and her article has been removed from the GameDev.net quaternion section because it is full of wrong information. If you look at the first page of that article, click here, you will see Gamedev.net's disclaimer.
As a final note, quaternions are not necessary for a 3D game. You can use any method of rotation you want, either Euler angles, Axis angle, spherical angles, etc. |
cbx |
Posted - Apr 02 2003 : 03:03:55 AM hay your not Eric coleman. I mistook you for eric, that's why I said you did not say to use google.
quote: Originally posted by AT
quote: you did not exactly specify to use an advanced google site search
No, I said use the search box http://www.gamedev.net/reference/
|
AT |
Posted - Apr 01 2003 : 10:31:10 PM quote: you did not exactly specify to use an advanced google site search
No, I said use the search box http://www.gamedev.net/reference/
|
cbx |
Posted - Apr 01 2003 : 10:03:58 PM Whu Hoooooo! Vindication baby! Now that's what I'm talking about!
http://www.gamedev.net/reference/programming/features/whyquats/page4.asp
Check out the start of the third paragraph.
quote: Software engineers, in general, are not mathematicians.
And check this out!
quote: Quaternions lend themselves well to graduate projects and technical theses. They are very complicated, so describing them (and defending them) can take many words and many pages of formulas. Vectors, by comparison, are straightforward to the point of being boring.
I love boring! I say to hell with quaternions i'm sticking to my vectors and matricies all the way! Thanks Eric you've been a great help. I now know all i need to know about quaternoins.
And lets not forget this tidbit from the faq page.
quote: 7. Have you ever written any actual code? / Do you even know anything at all about mathematics?
A. I have been writing games professionally since 1987. I have a degree in mathematics.
|
cbx |
Posted - Apr 01 2003 : 9:42:37 PM Well you did not exactly specify to use an advanced google site search now did you! |
AT |
Posted - Apr 01 2003 : 9:16:18 PM Did you try typing quaternion into the search box ?
Search at gamedev.net for quaternions
Wow, look at the size of that ... |
cbx |
Posted - Apr 01 2003 : 7:47:07 PM OK, for starters I already kew about the game dev site. Second I have to thank you eric because I have found that dam page I was looking for, for the past 4 months. (PS: not a page about quaternions but the game company list page. )
Lastly. Yes I have and did look at the gamedev site. I looked thru all of the articles and beginers sections and i still have not seen anything on quaternions!
So not to push my luck with you any further and to save myself any more imbarrasment. Mabe, if you are willing to, post the url of the quaternion article you believe is on the gamedev site.
|
|
|
VBGamer |
© |
|
|
|
|