PDA

View Full Version : Animation



bazbazus
06-01-2010, 02:34 PM
Animation.Smd ---------> for Smd Model
Animation.cfg ---------> for Md3 Model
Animation.aaf ---------> for Md2 Model

????????????? ---------> for 3ds Model

tpascal
06-01-2010, 04:07 PM
GLscene is unable to use 3ds files for doing animation, only for extract static meshes.

bazbazus
06-01-2010, 05:09 PM
how accessing the head of my model.
in the model there are: head and foot .....
I want to rotate the head of my 3ds model.

noeska
06-01-2010, 06:14 PM
Have a look at the documentation for glscene: http://glscene.sourceforge.net/wikka/GlsceneHelp

tpascal
07-01-2010, 06:33 PM
how accessing the head of my model.
in the model there are: head and foot .....
I want to rotate the head of my 3ds model.


Animation for models are most the time "pre-recorded", it is done in an animator tool, you build a walk, run, jump, etc animation for your model, you save that data in a file disk, some file format allow to save mesh and animation data in same file, some format allow to save the animation data in a different file.

Then in your glscene, you load those models and animations and then you just "play" those animations.

as far i know, glscene allow to load and play animations recorded from Quake files *.aaf and from Half-Life files *.smd., also from milkshape.

3ds files are not useful for animate actors in glscene, it is only usefull for load static objects like chairs, tables, etc.



I want to rotate the head of my 3ds model.


It can be done, but not with models loaded in 3ds files, if you want to select different parts of you model, like the head, and do dinmic animations then you need to load the model from *.smd or from milkshape files, which include the info about wich parts your model is divided ("skeleton").

i suggest to suscibe to glscene support newsgroups:


news://forums.talkto.net/glscene.support (copy and paste the text in your browser)

Brainer
07-01-2010, 08:08 PM
I may be wrong, but I think they added support for animations in a 3DS file. ;)

bazbazus
08-01-2010, 02:17 AM
tpascal thanks , ok my model is a smd file and i made a skeleton
how i can select different parts of my model
i want to do exemple :
Model[head].rotation.z:=Model[head].rotation.z+1;

What is the correct source ?

Brainer
08-01-2010, 04:25 PM
I can't say for sure, but there was somewhere a method called GetBoneByName, so that you can transform particular bone knowing its name.

By the default, in 3DSMax bones are named Bip01 [bone name], so your head is probably Bip01 Head, but I may be wrong. You best check it yourself. :)

tpascal
08-01-2010, 08:42 PM
tpascal thanks , ok my model is a smd file and i made a skeleton
how i can select different parts of my model
i want to do exemple :
Model[head].rotation.z:=Model[head].rotation.z+1;

What is the correct source ?


//--------------------------------------------------------
Ok, you did the skeleton, you already know a skeleton is a Hierarchical bone tree structure starting with root bone and then following with childrens. From your modeler you need to take note where the "head" bone is located in the tree.

ok, model is a tglactor type, so you can have access to bones this way:

model.skeleton.rootbones.items[rootNo].items[childrenNo]...until you get the desired "head" bone, .items[desiredbone].globalmatrix

Transform "Globalmatrix" matrix as you like for translate/rotate the bone, then you need to propagate the matrix change to all his childrens using procedure .items[desiredbone].PrepareGlobalMatrices;

you can also get the desired bone using:
model.skeleton.BoneByName() or model.skeleton.BoneByID() functions.

The above was about transforming at run time the skeleton "Bind pose", or "T pose", which is not just a standard procedure, and it will affect the keyed frames animation current playing, for example the run animation will be played with the head rotated. You have to be skiled with matrices math to restore the globalmatrix to original state and do different transformation.

//-----------------------------------------------------------------------
Transforming at run time the skeleton it is not commun and maybe it is not what you want; in games most the time what it is done is to animate the character via key frames, preserving the original skeleton pose.

You build all animation in your modeler, standstill, run, walk, jump, die, attack, etc.
Then in game you switch from animation to animation, based in user control or events, your character will ALWAYS have an animation current playing; when the user is not using the control and nothing is happening in the game, then the character is playing a standstill animation and ocasionally it's interrupted by a random iddle animation.
//-------------------------------------------

Anyway, lets say that you still interested in animate your character passing values inside the program like in your example above; for doing that using frames you need to add ad a "empty" animation, and then add one or more "empty" frames;

then you acces the frames:

model.skeleton.skeletonframelist.items[FrameNo].Position.items[boneNo]; //x,y,z
model.skeleton.skeletonframelist.items[FrameNo].Rotation.items[boneNo]; //x,y,z euler.

You need to use then: model.skeleton.skeletonframelist.items[FrameNo].flushlocalmatrixlist;
to propagate the changes to all his childrens.

Note that model.skeleton.skeletonframelist.items[] store ALL FRAMES for ALL animations, (run, jump, walk, etc) linearly, you have to use model.animations.items[AnimationNo].startframe & .endframe for know the ranges frames for your desired animation.
//--------------------------------



I may be wrong, but I think they added support for animations in a 3DS file.


Brainer:
I have checked the file3ds.pas and seem that you are right, it looks like skeleton and frames are now parsed, i have not tested if that is really working, but it is good to know that seem finally we can read animations from 3ds in delphi; ;)

GLscene is the best source code info for 3d programing in delphi, :yes:, too bad the info was never full documented, we have to check for the demos to learn how class work; i am very interested in the OPENBSP code, that is somthing that i have not seen exploited in delphi, it is even forgoten, the guy who coded openBSP removed that product from his web site, i wonder if there is some legal issue; I dont found another free BSP compiler for pascal programmers.

Brainer
09-01-2010, 07:15 AM
i am very interested in the OPENBSP code, that is somthing that i have not seen exploited in delphi, it is even forgoten, the guy who coded openBSP removed that product from his web site, i wonder if there is some legal issue; I dont found another free BSP compiler for pascal programmers.

As far as I know, the BSP format is a copyright of Valve and if you ask me, there might be legal issues concerning the OpenBSP project.

The guy you mentioned, Osman Turan, has not been seen active for quite a long time now (like half a year or so). Last time I chatted with him he was developing a new compression algorithm. You can get the program from his website - www.osmanturan.com.

GLScene is a good source of learning 3D development in Delphi. I do remember I used to fiddle a lot with it, but more ambitious might find it limiting. That is why I dropped it, but still I'm watching its development. :)

chronozphere
09-01-2010, 10:25 AM
Did you check all the demo's? Maybe there is a GLScene demo for SMD animation. :)

bazbazus
09-01-2010, 03:40 PM
tpascal thankyou ;) ;) ;)