• Announcements

Archived

This topic is now archived and is closed to further replies.

simple skeletal animation and sound

Recommended Posts

Hi! I''d like to know if there is any way to do skeletal animation without using matrices in any way. The data is stored so that each joint knows its parent. Would I have to create a tree of some sort or what? also does anyone know of any tutorials on playing wave files WITHOUT using a library (its for the apocalypse contest)? thx.

Share on other sites
quote:
Original post by baldurk
Hi!
I''d like to know if there is any way to do skeletal animation without using matrices in any way. The data is stored so that each joint knows its parent. Would I have to create a tree of some sort or what? also does anyone know of any tutorials on playing wave files WITHOUT using a library (its for the apocalypse contest)?
thx.

Well, you could use quaternions instead of matrices, but somehow I don''t think you''ll like that any better. Sorry dude, matrices is the way compsing rotations is done.

Share on other sites
Dude, you''re doing exactly what I did not too long ago - limiting yourself because you''re scared of the maths. You deserve better!

You don''t need to understand why and how they work, but if you first get to know when and how to use them, it just becomes clear.

I know it''s big & nasty (was for me anyway), but try one of these:

http://www.cse.unsw.edu.au/~cs3421/slides/3D/ps/lect1.pdf - Nice OGL intro that talks about matrices in a non-wordy way, just shows you them

http://www.stud.uni-goettingen.de/~npovala/oglmatrices.html - Pretty useful reference at a good level

Sorry, I don''t mean to sound patronising - I just know how you feel is all.

HTH,
aSe

Share on other sites
I''m in algebra2 (freshman highschool) and in like the 2nd chapter of the book they covered matrices and somehow everything came into my mind and makes sense in such a clear way. I think its just the idea of not understanding how you multiple them and what the result is and stuff that scares people, at least it did for me
Pick up an algebra book or email me max621@speakeasy.net

Share on other sites
Skeletal animation is quite simple really, however I think you''ll find you''re making the situation very awkward and time consuming if you do not use matrices. The ''bone'' -is- a matrix, and just like in OpenGL (whereby you can rotate and translate the scene) you use this matrix to express a given ''movement'' for that bone. A 3D model which uses bones will normally associate vertices in the model with one of the bones in the model, then the vertices are transformed by the bone matrix relative to their position.

Things get more interesting when you create a hierarchy of bones (IE matrices) - which is the most logical thing to do as bones in a skeletal structure in real life are not free form, they are all attached via links of some form. Well, mathematically, all you do then is concatenate the transformations. Say we''re translating the arm, first of all you have the main model transform which defines where in 3d space the model is (This will not affect any bones), then you transform the upper arm, then you transform the lower arm. Now the lower arm must be transformed by the upper arm because it is a child of the upper arm, and as a result of which it is directly affected by any transform applied to its parent.

Things get even more interesting when you start applying constraints and physics to bones ;-)

I don''t know - I haven''t really given any thought to doing bones without matrices. Thinking about it now - yeah, it still seems pretty much impossible! Even if you expressed the transformations of the bones without matrices, you would still need a matrix to apply the transform to each vertex... Or maybe you wouldn''t?... I can''t know for sure - I dont know everything about 3D math! Certainly if there is another way, I''d bet that using matrices is more convenient... Maybe there is a way without matrices. If you express the transform using a vector for the translation, and a set of angles (x,y,z) to express the rotation, if you know how to apply them to a vector (So it is suitably translated and rotated) then you essentially have a bone system :-) Although that system would be susceptible to gimbal lock.

Just have a quick peek at some matrix handling code from somewhere - matrices really are so simple to implement, and every single 3d game out there uses the same code pretty much. Some games have the routines optimised in asm, some games have the routines in a class, some games use C++ to interlink the matrix and vector classes, but I can guarantee without a shadow of a doubt, that essentially they''re all using the same damn code - so I say for the time being, forget learning the code, see if you can pinch it from somewhere... Think of it as a loan *g* You''ll have time after the contest to learn how matrices work. God knows there''s enough tutorials on them out there on the net!

(Trust me - matrices must be simple because I get how they work, and I suck at maths!!!)

Share on other sites
argh. argh argh argh.

My problem is that I am still at a very low level in maths (things like volumes and areas) and there is no way to get private tuition from my teacher at lunchtimes and stuff, so I''m stuck. I''ve tried tuts on the net but just can''t get the hang of them.
I suppose my problem with skel. anim. is that I can''t work out a way to calculate how much the hand moves if the shoulder is turning. *sigh*
Any ideas on sound?

Share on other sites
Now THAT one we can help with

FMOD - see www.fmod.org. Simplicity itself; first download the SDK, and try this code. Being someone who hates the verbose sample programs in SDKs, I like to figure out the absolute minimum work required to get an API to do something, then add the niceties back in as and when I need them.

So, here's my minimal code to play an MP3 with FMOD - incidently it's IDENTICAL to play a WAV, just pass it a different filename!

  // Libs and headers we need to include#pragma comment(lib, "fmodvc.lib") // Obviously you need to copy the lib and header from the SDK to your project directory...#include "Fmod.h"// Variables we needFSOUND_SAMPLE *mp3; // FMOD sound sampleint mp3Channel; // To remember the channel FMOD's assigned it// Setupif (FSOUND_GetVersion() < FMOD_VERSION) return false; // Check DLL versionif (!FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS)) return false; // Try and get the mode we wantFSOUND_SetOutput(FSOUND_OUTPUT_DSOUND); // Use DirectSound for output if available// Load MP3mp3 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "tune.mp3", FSOUND_LOOP_NORMAL | FSOUND_2D, 0);// To play itmp3Channel = FSOUND_PlaySound(FSOUND_FREE, mp3);// To toggle pause when you need toFSOUND_SetPaused(mp3Channel, !FSOUND_GetPaused(mp3Channel));// To set volume when you need toFSOUND_SetVolume(mp3Channel, 50);// To cleanupFSOUND_Sample_Free(mp3);FSOUND_Close();

Hope this helps...

Edited by - aSe on October 19, 2001 4:35:05 AM

Edited by - aSe on October 19, 2001 4:36:05 AM

Share on other sites
Dammit, all that editing and then I notice you said without a library. Sheesh... oh well, maybe it''ll help someone else

• Partner Spotlight

• Forum Statistics

• Total Topics
627651
• Total Posts
2978397

• 10
• 12
• 22
• 13
• 33