PDA

View Full Version : 3D Model Blending



adityagaddam
11-12-2002, 03:28 AM
Ok I just read about HalfLife's model blending where the top half of the model would be doing one thing while trhe bottom ..another. My idea to doing this was:

Suppose the model has 30 frames and 10 of them have the character waving (wave_1...wave_10) while standing still, and then there is a 5 frame space of the person just standing still(stand_1...stand_5) and then the rest of the 10 frames the person is running(run_1...run_10). My idea to do this was that to make the person wave while running, we could render the frame wave_1 until we reach the torso of the character and then we can render run_1 for the rest of the character and then repeat the process with wave_2 and run_2 an so on.. My question is how can we "mark" the torso of the character in the 3d file and be able to identify it when loading the model.

-Thanks
Aditya

ioquan
11-12-2002, 08:34 AM
Just use a text file which tells the engine which joint represents the lower half and which represents the upper half. You may have other special joints tioo, like hands which need to have weapons attached to them. You can put these in this text file too.

[This message has been edited by ioquan (edited 11-12-2002).]

adityagaddam
11-12-2002, 11:02 AM
that is ok.. but how do we know what joint we are rendering at a given time? ...

sorry but I am just starting on 3d model loading. Oh and I am talking about MD2s.. does the file format make a different or can we know what joint it is for any file format?

-Aditya

jwatte
11-12-2002, 11:09 AM
md2 uses vertex (mesh) blending, aka keyframing. Unless you know which vertices affect the top of the body vs the bottom of the body, you can't do what you want with md2.

md3 does this as well, but stores separate meshes for top and bottom. Thus, you can run separate animations on top & bottom.

The right way to do this, though, is to render your character as a mesh that's skinned to a skeleton, and to animate that skeleton. When you animate the skeleton, you can run more than one animation on the skeleton, and specify which animation affect which joints (or even weight each joint different amounts to different animations).

None of this is especially OpenGL related, of course. You'd probably have better luck plugging keywords like "skinned mesh skeleton animation code" into Google, or going to general game development sites.

adityagaddam
11-12-2002, 05:16 PM
wow thanks.. well I guess I can just do it using two file but I will cetainly look into the character skinnijng thing

Thanks,
Aditya
P.S. any other help on this topic is welcome and aprreciated http://www.opengl.org/discussion_boards/ubb/biggrin.gif

yakuza
11-12-2002, 06:12 PM
There are tutorials with source code on animating md2 and md3 models here:
http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm

The model loading tutorials are on the previous page (page 4) of the same section. I'm pretty sure Nehe has tutorials on this topic as well:
http://nehe.gamedev.net

Hope that helps.

adityagaddam
11-13-2002, 03:19 AM
thanks a lot.. I was searching for more model format loading tutorials. This is good. Thanks a lot guys.

-Aditya