Thread: [Plib-devel] Quaternions in plib
Brought to you by:
sjbaker
From: Sam S. <sa...@sp...> - 2000-08-10 23:12:42
|
Well, it appears it was my code that was broken - not plib. This evening I took the tux on a pedestal example and adjusted it so you can fly around tux using quaternions, and it all works fine. I nearly got carried away and changed it so you could fly tux about - but then I remembered it's susposed to be a simple example. As it uses the tux data files should I place it in examples/src/tux or examples/src/quaternions and set the model and texture paths to ../tux/data? I prefer the later myself, but that's me. If I get the time I'll write a small article to go with the exampe source. Incidently why does sgCoord store euler angles? Aren't eulers evil? :) I would had expected an (x, y, z) vector and a quaternion. Sam |
From: Michael K. <neg...@ea...> - 2000-08-11 00:20:07
|
----- Original Message ----- From: Sam Stickland <sa...@sp...> To: <pli...@li...> Sent: Thursday, August 10, 2000 11:57 PM Subject: [Plib-devel] Quaternions in plib > Well, it appears it was my code that was broken - not plib. > > This evening I took the tux on a pedestal example and adjusted it so you can > fly around tux using quaternions, and it all works fine. I nearly got > carried away and changed it so you could fly tux about - but then I > remembered it's susposed to be a simple example. Thats good to hear. I fixed the Quaternions many months ago and made a small demo of a cube that spun. The spinning could toggle between eular angles and quaternions. It wasn't using any other part of PLib except the math library so I never sent it in. But it's good to hear someone else has finally used the Quaternion code for *something*. I'd really like to know why more people aren't using quaternions for camera control. |
From: Amit B. <am...@de...> - 2000-08-11 00:32:32
|
Because it's overkill. You don't need to use quaternions for everything. The only thing I use them for is for interpolation keyframed animations. For camera controls , eulers work fine; have been for years. As long as you know the limitations of eulers, you should be fine. ----- Original Message ----- From: "Michael Kurth" <neg...@ea...> To: <pli...@li...> Sent: Thursday, August 10, 2000 5:25 PM Subject: Re: [Plib-devel] Quaternions in plib > Thats good to hear. I fixed the Quaternions many months ago and made a small > demo of a cube that spun. The spinning could toggle between eular angles and > quaternions. It wasn't using any other part of PLib except the math library > so I never sent it in. But it's good to hear someone else has finally used > the Quaternion code for *something*. I'd really like to know why more people > aren't using quaternions for camera control. |
From: Sam S. <sa...@sp...> - 2000-08-11 00:55:11
|
----- Original Message ----- From: "Amit Bakshi" <am...@de...> To: <pli...@li...> Sent: Thursday, August 10, 2000 5:30 PM Subject: Re: [Plib-devel] Quaternions in plib > > Because it's overkill. You don't need to use quaternions for everything. > The only thing I use them for is for interpolation keyframed animations. > For camera controls , eulers work fine; have been for years. But if you have a camera that can move on all three axes, then it's going to screw up pretty quickly. I can't believe that these sort of cameras are all that rare (any space/flight sim for example). Quaternions have the advantage that they don't need to be reorthoganised _ever_, and from my prespective four floats is a damn site better than twelve for network transmission (OK, so it's a naive implementation - you could get away with transmitting a single unsigned int if you used a lookup table. Again quaternions would be quicker to lookup). Sam |
From: Alexander R. <a_r...@in...> - 2000-08-11 01:17:39
|
Hi, > > > ----- Original Message ----- > From: "Amit Bakshi" <am...@de...> > To: <pli...@li...> > Sent: Thursday, August 10, 2000 5:30 PM > Subject: Re: [Plib-devel] Quaternions in plib > > > > > > Because it's overkill. You don't need to use quaternions for everything. > > The only thing I use them for is for interpolation keyframed animations. > > For camera controls , eulers work fine; have been for years. > > But if you have a camera that can move on all three axes, then it's going to > screw up pretty quickly. I can't believe that these sort of cameras are all > that rare (any space/flight sim for example). Quaternions have the > advantage that they don't need to be reorthoganised _ever_, and from my > prespective four floats is a damn site better than twelve for network > transmission (OK, so it's a naive implementation - you could get away with > transmitting a single unsigned int if you used a lookup table. Again > quaternions would be quicker to lookup). > > Sam I have neither knowledge of net-related problems, nor have I designed the net part of my game yet well enough, bu I think that this is irrelevant ! The speed of the game played through the net does not depoend on the size of the data transferred at each frame, but on the time the packet needs to go from joystick to client engine to client net, there to the internet to some distant server (TIME! is lost), into the servers engine, and then back to the clients. if the delay time gets to great, game hangs or so But you can't improve delay time But I really have to admit that I dont kniow what I'm talking about, cause I am a novice in Net stuff as well as in 3D. > > > > _______________________________________________ > plib-devel mailing list > pli...@li... > http://lists.sourceforge.net/mailman/listinfo/plib-devel > I've just downloaded ACE... Alex -- Alexander Rawass Email: ale...@us... Project Homepage: http://kobayashimaru.sourceforge.net ...but some day you'll be a STAR in somebody else's SKY... |
From: <Va...@t-...> - 2000-08-12 15:40:11
|
Alexander Rawass wrote: > > I have neither knowledge of net-related problems, > nor have I designed the net part of my game yet well enough, > bu I think that this is irrelevant ! > > The speed of the game played through the net does not depoend > on the size of the data transferred at each frame, but > on the time the packet needs to go from joystick to client engine to > client net, > there to the internet to some distant server (TIME! is lost), into the servers engine, > and then back to the clients. Wrong! Lag and data size are important. You are saying that e.g. for a car only the top speed matters but not the power of the engine. I can be faster than 200 km/h with a car that has only 1 horse power (by driving out of a plane...). The other way round also doesn't make sense (a tank is much slower than a motor bike, although it is much stronger). A normal user doesn't know that the amound of data is important - because the game designers have alrady taken care of it. There are actually many things that have to be taken care of when you are thinking of adding net support: - the phyiscal connection limits the amount of data which you can transport in a certain time - the protokoll reduces that rate and can cause other problems. Either it guarantees you that you recieve the data - but that can be whenever (TCP does that). Or it transports the data as fast as possible - but might get lost (UDP) - The network funktions of the OS might give you additional limitations And there are definitely many more of those. CU, Christian |
From: Alexander R. <a_r...@in...> - 2000-08-13 02:28:24
|
Christian Mayer wrote: > > Alexander Rawass wrote: > > > > I have neither knowledge of net-related problems, > > nor have I designed the net part of my game yet well enough, > > bu I think that this is irrelevant ! > > > > The speed of the game played through the net does not depoend > > on the size of the data transferred at each frame, but > > on the time the packet needs to go from joystick to client engine to > > client net, > > there to the internet to some distant server (TIME! is lost), into the servers engine, > > and then back to the clients. > > Wrong! Lag and data size are important. You are saying that e.g. for a > car only the top speed matters but not the power of the engine. I can be > faster than 200 km/h with a car that has only 1 horse power (by driving > out of a plane...). The other way round also doesn't make sense (a tank > is much slower than a motor bike, although it is much stronger). > > A normal user doesn't know that the amound of data is important - > because the game designers have alrady taken care of it. > > There are actually many things that have to be taken care of when you > are thinking of adding net support: > - the phyiscal connection limits the amount of data which you > can transport in a certain time > - the protokoll reduces that rate and can cause other problems. > Either it guarantees you that you recieve the data - but that > can be whenever (TCP does that). Or it transports the data as > fast as possible - but might get lost (UDP) > - The network funktions of the OS might give you additional > limitations Yeah, of course, if the max transfer rate is 3.0kB per sec, of course the data sent in this time has to be less than 3.0kB But if've heard of other commercial games having big problems with mutiplayer playing, not because the data transferred is to large but simply to the ping delay between client->server->client I've never played that online, but XwA/XvT should have some instruments there showing you your pingtime, and when it goes red, the delay gets too long. Are there fast commercial games playable per modem? Really playable on internet servers some distance away? I think a german magazine said "...Well..." Correct me. For my game, I'll do first concentrace on running it on 10Mbit lan. This may sound wrong too you, but it will show success (hopefully) quick and then I'll think about improvements etc. Alex |
From: Steve B. <sjb...@ai...> - 2000-08-11 08:42:29
|
Sam Stickland wrote: > Quaternions have the > advantage that they don't need to be reorthoganised _ever_, ...but they *do* have to be renormalized - and in theory, that's just as arbitary as orthoganalization. > ...and from my > prespective four floats is a damn site better than twelve for network > transmission (OK, so it's a naive implementation - you could get away with > transmitting a single unsigned int if you used a lookup table. Again > quaternions would be quicker to lookup). * For 3D rotation only, you only need nine floats to send a matrix - and for a quaternion, you only need to send three floats plus a sign bit. Of course, Eulers only need three floats - so in terms of network bandwidth, they beat Quaternions by over 1% ! :-) * Comparing a 4x4 matrix to a quaternion isn't fair. A matrix can to a heck of a lot more than a quaternion - translation, scaling, perspective, shearing, projection onto an arbitary plane, *and* rotation. Quaternions can only do the latter. * Multiplying matrices together is faster than quaternions despite the larger number of terms because the math is simpler. * Transforming vertices using a Quaternion is a *nightmare* compared to using a matrix. * Quaternions score for interpolation, extrapolation and so forth. Quaternions have their place - so do Matrices *and* Eulers...I have rather a soft-spot for Quaternions - and what other mathematical entity every had a bridge erected in honor of it's multiplication rule? -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |
From: Alexander R. <a_r...@in...> - 2000-08-11 00:27:31
|
Hi, > > Well, it appears it was my code that was broken - not plib. > > This evening I took the tux on a pedestal example and adjusted it so you can > fly around tux using quaternions, and it all works fine. I nearly got > carried away and changed it so you could fly tux about - but then I > remembered it's susposed to be a simple example. > > As it uses the tux data files should I place it in examples/src/tux or > examples/src/quaternions and set the model and texture paths to ../tux/data? > I prefer the later myself, but that's me. > > If I get the time I'll write a small article to go with the exampe source. > > Incidently why does sgCoord store euler angles? Aren't eulers evil? :) I > would had expected an (x, y, z) vector and a quaternion. a) DONT USE EULER ANGLES AT ALL! b) use either direction vectors as I do, or quaternions, construct the transformation matrix yourself, BUT DONT USE EULER ANGLES! c) you can calc direction vectors/quaternions to euler angles, that is safe, the other way round is 'unsafe' d) It cost me a month , exactly this e) have a look at the math help page on kobayashimaru.sourceforge.net f) DONT USE EULER ANGLES! I expect SpaceThing and KobayashiMaru very similar, have a look at ssgUtil.cxx and spaceobject.cxx:PitchShip/MoveShip/setTransform will give ypou the code you need. Alex -- Alexander Rawass Email: ale...@us... Project Homepage: http://kobayashimaru.sourceforge.net ...but some day you'll be a STAR in somebody else's SKY... |
From: Steve B. <sjb...@ai...> - 2000-08-11 06:57:05
|
Sam Stickland wrote: > > Well, it appears it was my code that was broken - not plib. > > This evening I took the tux on a pedestal example and adjusted it so you can > fly around tux using quaternions, and it all works fine. I nearly got > carried away and changed it so you could fly tux about - but then I > remembered it's susposed to be a simple example. > > As it uses the tux data files should I place it in examples/src/tux or > examples/src/quaternions and set the model and texture paths to ../tux/data? > I prefer the later myself, but that's me. > > If I get the time I'll write a small article to go with the exampe source. > > Incidently why does sgCoord store euler angles? Aren't eulers evil? :) I > would had expected an (x, y, z) vector and a quaternion. Eulers *are* evil in the inner workings of a program - but they are a NECESSARY evil on the outer edges of the code - where user input comes in, etc. Hence, a library that purports to support 3D programming in a fairly general way should support Eulers, Matrices *and* Quaternions...which PLIB does. I rather draw the line at the fourth common method: "Translation+look-at-popint+vertical axis"...but I guess we should probably add some sort of support for that too. If you actually read my FAQ entitled "Eulers are Evil", you'll see that it actually ends up using Eulers in the final "Here is how to do it" example. -- Steve Baker HomeEmail: <sjb...@ai...> WorkEmail: <sj...@li...> HomePage : http://web2.airmail.net/sjbaker1 Projects : http://plib.sourceforge.net http://tuxaqfh.sourceforge.net http://tuxkart.sourceforge.net http://prettypoly.sourceforge.net |