.B3D: How to make character body out of several parts

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

.B3D: How to make character body out of several parts

Post by Alopex »

Hey, everybody.

I am planning a game that uses models saved as .b3d files. I was wondering how, with this format, one could make character bodies out of individual parts (i.e. head, torso, legs, arms, hands, and feet) rigged to the same skeleton. I know this is a common practice in 3D games with a lot of character customization, but I am looking for more information on how this would be done specifically in Irrlicht using the .b3d format.

I have tried looking for information on the subject before asking, and it was, quite honestly, a fruitless endeavor. I can't really describe what I am trying to do in a way that my search engine understands, if that makes any sense.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: .B3D: How to make character body out of several parts

Post by mongoose7 »

Irrlicht won't do this.

Are the body parts rigid or do you want to skin them? If they are rigid, you can load them separately into a hierarchy and apply the transformations to each part.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: .B3D: How to make character body out of several parts

Post by Alopex »

Skinned. Skeletal animation is the only kind with which I have even a speck of experience.

What I'm wanting to do is make it so that I can put different pieces of armor (gloves, boots, etc.) on a character, without having to make a different model for every glove/boot/armor combination. I also want to avoid possible clipping.

I read that you can have a .b3d file with the model in t-pose and then individual .b3d files for the animations. I also read that you can use a single animation file for multiple models, if they use the same skeleton. If those statements are true, then I don't see how having a body composed of several pieces rigged to the same skeleton would be impossible.

Or am I going in the wrong direction entirely?
chronologicaldot
Competition winner
Posts: 684
Joined: Mon Sep 10, 2012 8:51 am

Re: .B3D: How to make character body out of several parts

Post by chronologicaldot »

Greetings Alopex,

If you intend to manipulate the mesh directly, I recommend that you first become familiar with Irrlicht's mesh system. The files IMesh.h, IAnimatedMesh.h, and ISkinnedMesh.h can start you off. All meshes in Irrlicht are loaded into mesh classes that inherit from IAnimatedMesh and have mesh buffers that can be accessed with IMeshBuffer via IMesh::getMeshBuffer(u32). About the only reliable part in the abstract interface since the implementations take some liberties in organization "behind the scenes". That makes disassembling a mesh tricky if you don't know how it's stored.

It'd be better to simply load your objects as nodes and simply make them child nodes (of the main mesh scene node) that have animators that force them to follow the orientations of the main mesh buffers (of arms and legs, assuming those are animated). All animators inherit from ISceneNodeAnimator, and there are some simple ones like a flying and follow-path animator. I'm sure it'll be easier to do it this way.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: .B3D: How to make character body out of several parts

Post by Alopex »

Well, I guess I have a lot more research to do. Regardless, at least I have a direction to go now.

Thank you.
sunnystormy
Posts: 105
Joined: Mon Jun 02, 2014 2:32 am
Location: Washington, D.C.
Contact:

Re: .B3D: How to make character body out of several parts

Post by sunnystormy »

I've been toying with this idea as well.

One approach would be to create a "skeleton" mesh, which is invisible to the naked eye, and have assigned bones for the different customizable limbs (i.e. head bone, arm bone, foot bone, etc.).

Then you would simply look for those bones and bind child meshes to them. Irrlicht's mesh classes should allow you to scan for specific bones if I'm not mistaken... >_>

Let us know whether or not you succeed! :)
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: .B3D: How to make character body out of several parts

Post by mongoose7 »

You could just export all the body parts, each with the full skeleton and animation. Once they are arranged in a scene-node hierarchy, they should perform as expected.

(You could export the animation once and use 'useAnimationFrom'.)
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: .B3D: How to make character body out of several parts

Post by hendu »

I used this approach with the Monsters game, but md3 was designed to do so, it has explicit attachment points between the torso and legs, torso and head, and hand and gun.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: .B3D: How to make character body out of several parts

Post by Alopex »

Thank you, Mongoose.

I did exactly that, and It appears to work perfectly.
sunnystormy
Posts: 105
Joined: Mon Jun 02, 2014 2:32 am
Location: Washington, D.C.
Contact:

Re: .B3D: How to make character body out of several parts

Post by sunnystormy »

@mongoose7 @alopex

Is there a way either of you could document how this process works, or elaborate more upon it? This subject is something I'm interested in learning more about. :)

Thank you!
My blog: http://fsgdp.wordpress.com "The Free Software Game Development Pipeline"
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: .B3D: How to make character body out of several parts

Post by Alopex »

I definitely intend to document this, in some fashion or another, once I figure it all out.

Edit: I just figured out how to cast an animated mesh to a skinned mesh. Borrowing code from Mel:


scene::IAnimatedMesh* mesh;
mesh = smgr->getMesh("yourMesh.X");//can be B3D or MS3D also.

scene::ISkinnedMesh* skinMesh;
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: .B3D: How to make character body out of several parts

Post by mongoose7 »

A skinned mesh has a mesh and a skeleton. The skeleton consists of bones. Bones are just (local) transformations and affected vertices. So for an animation, start at the root. Transform the root vertices by the root transformation. Move down the skeleton by composing the transformations and apply the composed transformation to the bone's vertices.

Note that composing the local transformations is just what happens in a scene-node hierarchy. So, if the bones (transformations) only affect the local body part, it should work.

In general, though, the area of effect of a local transformation is general. And this is complicated by weights, where one vertex is subject to the motion of a number of bones.
Alopex
Posts: 41
Joined: Sat Sep 12, 2015 10:12 pm

Re: .B3D: How to make character body out of several parts

Post by Alopex »

Apart from useAnimationFrom(), is there any way I can store animations separately from my models?
CuteAlien
Admin
Posts: 9628
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: .B3D: How to make character body out of several parts

Post by CuteAlien »

To my knowledge that's currently the only way.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: .B3D: How to make character body out of several parts

Post by Mel »

Export a simple mesh which contains all the animations and build a skinned mesh on the fly. It may be very tedious to program, but not impossble and gives the best results :)

That is if your customized parts aren't just static meshes, in that case just load them and stick them via addChildNode. On your skinned meshes give a proper name always to the bones, and export them
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply