Skeleton overview / design philosophy?

Software: Away3D 4.x

Avatar
Choons, Sr. Member
Posted: 17 September 2011 09:03 PM   Total Posts: 281

Hi guys,

The skeleton classes and methods in Away3D 4.0 have always been confusing to me. I’m spending this weekend to finally get familiar with how they work, but am already scratching my head. I understand Skeleton containing the Joints hierarchy. And I get the parentIndex part for joints, but am a little surprised that joints only other properties are a name and inverseBindPose.

My plan here is to start withe a super simple case using a cylinder primitive with several segments, declare in code a skeleton and a couple of joints for it, assign verts to joints along with weighting, and move the joints to see if it’s all working.

Now, after using Away3D as much as I have this past year, I’m surprised how mysteriously difficult this simple test case is. Can anyone help out with how to approach what seems like it should be fairly easy example? Maybe even just an explanation of the design principle of the skeleton system?

   

Avatar
80prozent, Sr. Member
Posted: 17 September 2011 09:34 PM   Total Posts: 430   [ # 1 ]

thank you for asking this.

i have the same problem.
having all data imported from c4d, everything (submeshes/materials/lights/cameras/splineObjects) works fine, but i just cant get the skeleton to work.

i have gone through the skeleton class sources several times, but its like you said: confusing.
i skiped this issue for 2 or 3 weeks now so right now im not to much into this, but definitly need to pick it up and give it another go.

so really hoping this question is going to be answered.

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Choons, Sr. Member
Posted: 17 September 2011 09:47 PM   Total Posts: 281   [ # 2 ]

glad you are interested in this as well, but please start a new thread for that other question

   

Richard Olsson, Administrator
Posted: 19 September 2011 10:02 AM   Total Posts: 1192   [ # 3 ]

Skeletons are defined by the Skeleton/SkeletonJoint classes, and different poses are then defined by SkeletonPose/JointPose. If you want to animate using pre-defined poses, you use one of the “animator” classes, and create a sequence comprising any number of frames. The frames are skeleton poses over time.

   

John Brookes, Moderator
Posted: 19 September 2011 01:01 PM   Total Posts: 732   [ # 4 ]

super simple case smile

Just done a two frame animation in Maya and exported awd2.
Worked through awd2 parser tracing bits out trying to work out how its set up.
Got stuck trying to addFrame to a skeletonAnimationSequence (arcane)

All I can say is its not simple and Im not worthy smile)

Goodluck

   

Avatar
Choons, Sr. Member
Posted: 19 September 2011 05:13 PM   Total Posts: 281   [ # 5 ]

@Richard well I did at least figure out that much in my studies of the system. But that doesn’t really get me any closer to coding the example I mentioned.

@John yup that’s exactly what happens for me too. I studied the MD5 examples trying to follow all the method calls across the many classes. All it left me wondering in light of how many different skeleton classes there are is what’s the best way to do that elementary example I mentioned?

I want to know how to define a valid joint and manipulate it from within Away3D instead of having to pre-rig/animate the object in a 3D modeling program. It’s a knowledge thing for me - I realize that rigging and animating any kind of real character in Away3D is impractical so for any other posters here please don’t waste space suggesting that.

   

Avatar
80prozent, Sr. Member
Posted: 19 September 2011 08:54 PM   Total Posts: 430   [ # 6 ]

what i figured out this far:

- create a mesh and a geometry object.

- create a skeleton.

- create several joint objects and define their parentIndex, name and inverseBindPose.

- the root-joints parentIndex should be -1 ?

- apply the joints objects to the skeleton.

- instead of normal Subgeomentrys create SkinnedSubgeometrys.

- update VertexData / IndexData / UVData / JointIndexData / JointWeightsData for each SkinnedSubgeometry.


i guess the next step is to create a SkeletonAnimation
and define it as the Geometry.animation, which should set the mesh.AnimationState.
I get a error when i try this, also i am pretty shure my skinning data (buffers and joints) is correct.
After this you should be able to create a SkeletonAnimator referencing the mesh.AnimationState.

the SkeletonAnimation is what handels the skinning magic (agal code etc) ?
the skeletonAnimator is to controll its state?

hoping for more infos

 

 Signature 

sorry…i hope my actionscript is better than my english…

   

Avatar
Choons, Sr. Member
Posted: 19 September 2011 10:00 PM   Total Posts: 281   [ # 7 ]

yeah 80, nice break down of the problem. So I’m obviously not the only one who thinks this is all harder than it should be. You are correct about the root parentIndex being -1 I think. If you look at SkeletonJoint.as -1 is the default value for parentIndex so I assume in code you just skip that part for your root bone.

Really these joints/bones are like nested ObjectContainer3D’s except with vertices that can be partially “inside” more than one container. I think I could write my own skeleton system from that premise but I suppose it would all run on the CPU instead of the good hardware stuff. That’s kind of messed up when it seems easier to write a system from scratch than learn the existing one

   

John Brookes, Moderator
Posted: 19 September 2011 10:08 PM   Total Posts: 732   [ # 8 ]

all that then
Create SkeletonPose and add jointposes to that.

Then my next random guess was

var animationSeq : SkeletonAnimationSequence = new SkeletonAnimationSequence(“Bert”)
animationSeq.addFrame(pose as SkeletonPose, frameduration)

and thats where I gave in smile
Just playing

   

Avatar
Alejandro Santander, Administrator
Posted: 19 September 2011 10:09 PM   Total Posts: 414   [ # 9 ]

Hey guys, I hear a refactor on the animation system is on its way. Why don’t you collect all the things that you’d like on such system and post it as a feature request? Using it at the level you seem to be doing so should provide some valuable feedback and contribution to the engine.

   

Avatar
Choons, Sr. Member
Posted: 19 September 2011 10:17 PM   Total Posts: 281   [ # 10 ]

@John did it work? not clear on you there. I’d just like to be able to say in code “put an elbow joint here on this cylinder, now bend that elbow 90 degrees in 0.25 seconds.” Seems like it should be doable, right?

   

John Brookes, Moderator
Posted: 19 September 2011 10:31 PM   Total Posts: 732   [ # 11 ]

@choons
Never actually ran it, it would just fail
Its all the arcane inaccessible methods

SkinnedSubGeometry with
updateJointWeightsData
updateJointIndexData

and addframe for skelanimationsequence.

As for what do we want, meh im just playing…
thinks… access to as much as possible. smile

   

Avatar
Choons, Sr. Member
Posted: 19 September 2011 11:32 PM   Total Posts: 281   [ # 12 ]

yeah John I see what you mean. It seems strange to me that a joint doesn’t appear to have an array property that lists the vertices & their weighting that the joint affects. All those private vars in SkinnedSubGeometry are no help

EDIT: looking at MD5MeshParser.as wayyy down at the bottom there’s tacked on JointData & MeshData classes that start to make a little more sense about how to go about this

   

Richard Olsson, Administrator
Posted: 20 September 2011 07:08 AM   Total Posts: 1192   [ # 13 ]

Hey guys,

First of all, you have to realize that this is a system that has been built for flexibility and for performance. It may not be incredibly simple to understand it’s architecture, but that’s because you don’t have to. It’s the parsers’ responsibility to create the joints, weights et c, and it’s the animators’ responsibility to animate them. If there is a real need to be an easier way to create “procedural” skeletons, and to “procedurally” link them to a mesh, then we will probably create wrappers for it. If you feel that there is such a need, please file a feature request along with how you would want it to work.

A joint does not have transformations, because a joint (or rather the skeleton to which it belongs) can be shared between several meshes. You will probably only want to have one character skeleton, that you then reuse for all the NPCs in your game. There will never be a SkeletonJoin.rotate() method, because that would break the ability to share skeletons.

Instead, all transformations should happen on the JointPose objects in a SkeletonPose.

The fact that some methods are arcane should not be an obstacle for you. We use that namespace to indicate that “you should probably not do this yourself” but in the case of manually rigging a mesh and animating it by hand, you have to use the arcane methods. Because it’s a manual task that is usually performed by automatic systems.

If you’re not sure how to use namespaces in ActionScript 3, look it up in the AS3 documentation. Basically it comes down to puting this somewhere in your scope: “use namespace arcane”, or use the full qualified name (which is slower) in your look-ups: mySequence.arcane::addFrame(myPose, myDuration);

The internal classes JointData and MeshData in the MD5MeshParser have nothing to do with the Away3D animation system. They are intermediary data for the MD5 parser, and those instances get destroyed as soon as the data has been converted into the appropriate format. MD5 stores meshes and animations in pretty weird formats. If you want to peek into a parser, try looking at AWD2Parser instead.

The animator refactor that Alejandro refers to will not change anything regarding the questions raised here. It will be a general refactor to unify the animator interfaces, and has only little to do with skeletons specifically.

Lastly, if you want to pursue this manual path, I would suggest taking it bit by bit rather than trying to solve everything manually at once. Load a pre-skinned model and try setting up the animation. Replace the animator by your own animator sub-class which animates procedurally (i.e., doesn’t use a sequence to control the poses of the skeleton.) Trying to both create the data and animate it in a single step will always be difficult because you cannot be sure that the data is correct. Once you’ve solved one half, it’s safer to experiment with the other.


Cheers
/R

   

Avatar
Choons, Sr. Member
Posted: 20 September 2011 07:32 AM   Total Posts: 281   [ # 14 ]

now that’s something I can sink my teeth into. Thanks, Richard. Having an overview of the design architecture like that really clarifies things when you start looking at the system classes.

I appreciate that Away3D’s design is such that people don’t have to worry about what is happening behind the scenes if they don’t want to. I’m not one of those people, however. It’s important to me to grasp how it all works. Some of my best work has come from using a framework’s methods in ways different than they were initially intended. Plus I’d like to think at some point I could make a useful contribution with a decent mod.

I’ll check out the MD2 parser as you suggest, and thanks again for the thorough answer.

   

John Brookes, Moderator
Posted: 20 September 2011 07:36 AM   Total Posts: 732   [ # 15 ]

import away3d.arcane;
use namespace arcane
DOH smile

@richard not in any way critising, just playing/learning
thnx

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X