Skeletal Animation Idea?

Started by cyberkilla, February 06, 2007, 01:52:36 AM

Previous topic - Next topic

cyberkilla

Well, fantastic:) No problem here then.

One thing I am concerned about, is the vertex sharing.
The model claims it doesn't support it,
and the method to disable it in jPCT claims it is performance degredating.

Each triangle has its own unique vertexes. It is simpler to load though, Ill grant them that;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

I would ignore this "problem" for now. If the format doesn't support it, disable it. If it becomes a real problem in the future, we can think again about how to handle it better.

cyberkilla

Egon, I want to keep to the style you  prefer, so have you any opinions on how I should implement skeletons?

I was thinking about having all skeletal-enabled loaders to return a SkeletalObject3D(name can change:)).

This will encapsulate all methods for object manipulation.

There will be two modes. Something like...

#1. SkeletalObject3D.createAnimations() - make mesh animations from skeleton.
#2. On-the-fly vertex changes, IK support, etc.

The 1#. mode will be made first.
The code isn't very hard:O I am, at the moment at least, very impressed by the easy of creation here.
Bones are rotated around an axis vector, by an amount in radians.
I might get confused with skeleton/model object/world spaces, but thats about it.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Sounds good to me. Do it in whatever way YOU prefer. Many things in jPCT are not the way they are because i prefer them that way but because of historical reasons. If something doesn't fit your needs, just do it different...

cyberkilla

Understood:)

I like the idea of extending Object3D, because it means you can use it like any other object, to the largest degree possible.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

I'm moving onto skeletal loading now, and I have discovered a few things...

Firstly, the keyframes in the OrgeXML format seem to be timed, however, the timing is linear, in that it goes up in increments, almost like a sample rate of in-modeler movement, and not actually the frames where I moved the models.
This means I can treat the movements as one object, which is handy, to say the least!

It only supports one skeleton per model, but multiple bones per vertex.
This is what "blending" is referring to. I do not know of the correct algorithm to do this, but I will mess around with it, until everyone is happy.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Encouraging logs...:)


Loading model(s) from OgreXML format...
Loaded from InputStream(198664bytes)
Loading skeleton data...
Loaded from InputStream(109988bytes)
New bone(RightHip)
New bone(LowerBack)
New bone(LeftHip)
New bone(RightLeg)
New bone(RightShoulder)
New bone(LeftShoulder)
New bone(Back)
New bone(LeftLeg)
New bone(RightAnkle)
New bone(RightArm)
New bone(LeftArm)
New bone(Neck)
New bone(LeftAnkle)
New bone(RightFoot)
New bone(RightWrist)
New bone(LeftWrist)
New bone(LeftFoot)
New bone(RightHand)
New bone(LeftHand)
Loading bone hierarchies...
Bone hierarchy loading completed.
Loading animation sequences.
New animation track(RightHip)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LowerBack)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftHip)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightLeg)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightShoulder)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftShoulder)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(Back)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftLeg)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightAnkle)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightArm)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftArm)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(Neck)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftAnkle)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightFoot)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightWrist)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftWrist)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftFoot)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(RightHand)
Loading track keyframes,,,
Track keyframe loading completed.
New animation track(LeftHand)
Loading track keyframes,,,
Track keyframe loading completed.
Animation sequence loading completed.
Skeletal data loading completed.
Found new submesh!
Disabling vertex sharing.
Creating triangle data.
Loading vertex->bone assignments...
Vertex->bone assignment completed.
OgreXML model(s) loading completed.
Model Loaded..
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

It rotates!!!!!

Wow! It works, although, its rotating everything around the wrong pivot:P

I think i need to rotate all of the skeletal pivots:D
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Its alive! My strange cube-like snake arks it's back!

Skeletal animation is basically finished!
Well, Ive tested rotation, and its working perfect:)
The translation keyframes should work too, but I havent made any models to test it yet:D
May I just ask... Is anyone interested in skeletal animations for their projects here?



EDIT:
I will also be making a simple java utility, to convert several skeletal model formats into my own, also free format:).
Why? why? Because I want to support multiple skeletons! Cant think of a more convienient way to, for instance......

Put a cape on a human model, allowing the cape to move on its own, and
move with the models legs and arms!
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Looks cool... :shock:  I can't wait to play around with it. There have been quite a few attempts to add something like this to engine (not by myself) but no one ever completed anything...to be honest, i think that no one has ever started. Great work!

cyberkilla

Online documentation of the skeletal api.

Some things to finish today...

-Auto sort bone hierarchy.

Oh, and I really should be rotating the normals. I didnt do that, because I didnt think it to be a priority.
I think I will add a method to set this on/off, because it will surely provide additional cpu usage, that might not even be noticable.

http://www.rpwar.com/cyber3/doc/

#### Opinions are welcome, and appreciated! ####

Oh, here is the source. Commented:)

The api is free. Im not making it gpl, because its restrictive. Neither is it public domain.

Credit me for making it, but do as you please:)
I really hope someone other than me finds it useful.
http://www.rpwar.com/cyber3/jpctSkeletalAPI.jar---IGNORE THIS. NEEDS UPDATED


Oh! I haven't implemented Inverse Kinetics yet, but i will. If you need it sooner,
you could do it yourself, which would be nice:)
I really don't think it will be hard.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

manumoi

Hello, I am very interested by what you have done for my own project... Currently, don t have time to work on my code ... But i hope things will be better after the end of march... Will come back to you at this moment.

Great job.

Manu


PS:  Maybe it would be cool to have a code sample on how to use your API

cyberkilla

Yes, good idea:)

By the way...

jPCT XML Loader in use now.
Animation changing permitted.
Axis correction complete.

Problems...
Pivot inheritance of rotation matrix during animation seems a bit off.
Almost inverted. Im confident ill have it fixed tonight:)
After that, I will do more screenshots, and provide examples.

Its really just a Loader.loadOgreXML(),
then setAnimation("idle")
and calling advanceAnimation on the skeletalObject3D:)

Couldnt be easier;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft

hey, what a progress cyberkilla, i'm quite impressed  :shock:   as others i'm looking forward for screen shots  :wink:

how much is your implementation compatible with ogre3d's format at the moment ?

r a f t

cyberkilla

Well, I can export something in blender, and load it, along with its skeleton, and uv mapping:).

I havent fully tested the uv, but it seems fine.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG