Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Interchangeable equipment / "body parts"

Author
Message
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Apr 2013 01:04
I've been pondering about this for a while...
Assume I'm making a RPG-style game and want to swap parts of the character mesh depending on what kind of armor he is wearing.
Weapons / shields and the like are relatively easy; you just align them to the hand joint / limb for each frame, but here we would need parts that actually follow the animations of the underlying skeleton.

I know the "easy" solution to this would be to load each part as a separate object and then set them to the same position / rotation and synchronize their animations. That would mean that they each must have separate animations however.
I was thinking that it would perhaps be possible to use change mesh on the limbs that carry meshes (ie. leave the skeleton as-is) to update this, but I haven't had much luck with that (the newly replaced meshes tend to end up with seemingly incorrect transforms).

I figure someone else might have tried this or at least have some better knowledge or ideas about it and would like to share, so why not ask?


"Why do programmers get Halloween and Christmas mixed up?"
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 24th Apr 2013 03:08
there's glue object to limb command

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Apr 2013 03:41
There is but a glued object wouldn't be affected by the underlying skeleton of the "parent" object, just the immediate transform of the limb to which it is glued... or am I wrong?


"Why do programmers get Halloween and Christmas mixed up?"
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 24th Apr 2013 17:35
Quote: "or am I wrong?"

no, you are correct

What you want to do is impossible. All vertices that are affected by bones have weights which determine the influence of the bones so you can't just add additional vertexdata and expect that animations work on it. You also need to set up weights of every added vertex and that's where the problem is - there's no commands for that.

So, glue object to limb is the closest you can get to what you want.

Your method of syncing several different objects with the same animation may work but it will be slow.

For every part you will have to play the same amount of the animation frames (animation is actualy transformation of the bones throught time) which will lead to huge slowdowns - depending on amount of added parts (dbpro is awful at animations).

Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Apr 2013 18:17
Quote: "(dbpro is awful at animations)."

Enhanced animations is good at animations.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 24th Apr 2013 18:30
Quote: "What you want to do is impossible."

I was afraid of that.
Oh well, I'm using enhanced animations and I can apply the same animation to each part, I guess it will indeed slow down a bit as the skeleton is dusplicated for all part-meshes, I don't know how much though. Guess I'll have to look into it.
Another problem will arise with raycasting / collision checks then though... Again you could do it on all part-meshes but I'm seeing some significant speed drops coming then..


"Why do programmers get Halloween and Christmas mixed up?"
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 24th Apr 2013 18:47
What I would do is have seperate meshes for each body segment.

I.E.
Feet seperate to Legs, seperate to torso, seperate to arms, seperate to neck/head.

Then all you would need to do is remove each segment and replace with the new bit. Position all segments to the same location and animate as normal.

It would be no slower than any other method.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 24th Apr 2013 19:13
Might be worth creating a multi-mesh character and hide/show/exclude the limbs accordinly. For example characters with something in their side pocket could hide the empty side pocket limb and show the packed pocket limb.

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 24th Apr 2013 23:25
Quote: "Then all you would need to do is remove each segment and replace with the new bit. Position all segments to the same location and animate as normal."

How do you then avoid texture seams, normal mapping shaders and even DBP regular lighting will show seams at the borders between meshes?

Rudolpho
20
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 25th Apr 2013 00:09
Quote: "What I would do is have seperate meshes for each body segment.

I.E.
Feet seperate to Legs, seperate to torso, seperate to arms, seperate to neck/head.

Then all you would need to do is remove each segment and replace with the new bit. Position all segments to the same location and animate as normal."

That's exactly what I was proposing in the opening post I think. Do you mean to say it is possible after all?

Quote: "All vertices that are affected by bones have weights which determine the influence of the bones so you can't just add additional vertexdata and expect that animations work on it."

It should be noted here that the intention was to copy all the vertices that make up a certain limb from an object which shares its skeleton with the one whose limbs are to be replaced.


"Why do programmers get Halloween and Christmas mixed up?"
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 25th Apr 2013 01:01 Edited at: 25th Apr 2013 01:02
Quote: "How do you then avoid texture seams, normal mapping shaders and even DBP regular lighting will show seams at the borders between meshes?"


I think you may be imagining bone based object with mesh deformation. I was not thinking of this, I was thinking of purely limb based objects.

Limb based objects won't have this issue as each segment will be textured/shaded with it's own textures/shader.

If you have an object which is made up of x amount of limbs, each limb is a complete convex object, textured as it needs to be. Simply swapping it out will have no effect on the rest of the object.

I live for video games! (And beers, and football, and cars!)
See what I live for here: [url]http:\\www.TeamDefiant.co.uk[/url]
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 26th Apr 2013 06:12
Yeah that's where I was coming from. I'm getting awful texture seams using evolved normal mapping. The built in DBP shading shades nicely ignoring texture seams. The evolved shader doesn't and creates shaded edges along the seams.

Thought this was the same thing as being discussed, guess not.

Login to post a reply

Server time is: 2026-07-06 20:31:27
Your offset time is: 2026-07-06 20:31:27