Skeletal Animation Idea?

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

Previous topic - Next topic

manumoi

Have to say, you are damn good cyberkilla.... Really interesting work :P

cyberkilla

http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft

it is quite a progress cyberkilla ;)

Quote from: "cyberkilla"I dont have the time to start something like MD4(which I cannot find decent docs on), or the .x file format, which is just rediculous.

Whats more, Blender hasn't managed to save ANY skeletal animation for me into any format that allows it!

i will say this risking looking too contrariety :roll: i wouldnt go after a proprietary format like MD4 since it misses the point: you still cant use well known 3d tools.

it's much like, using series of 3ds files for keyframe animation instead of md2 format. what do we have for md2: milkshape and a commerical unstable exporter for 3d max. i didnt wanted to use both so i went after loading animation from 3ds files

i would ideally will try to stick ogre3d's (or another good open source one's) skeletal animation format and will try to implement it on top of jPCT. it has exporters for all populer 3d tools including blender, 3d max, maya etc. similar to your one it also exports to xml files. this way we have ready animation editors and exporters and we can save our efforts for the real animation part with jPCT

r a f t

cyberkilla

Well, I did not know that it was xml format! :)

I will look into it! It will save me making a parser. Thank you Raft;)


Oh, Raft, i've looked into this format! I understand a lot of this format!

Perhaps something can be done!:)

EDIT:
You must be joking! This format is fantastic! Its human comprehendable:O

Im sure my opinion will change in a few hours, after i have tried to import it:D

Egon, i will ignore skeleton for now, and just load the standard data. I will try to copy what you did in your example posted here:P
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft


cyberkilla

Skeletal file..

<skeleton>
<bones>
<bone id="3" name="RightHip">
<position x="0.018071" y="12.328736" z="0.337703"/>
<rotation angle="3.141593">
<axis x="0.880204" y="0.461116" z="0.112310"/>
</rotation>
</bone>
<bone id="8" name="LowerBack">
<position x="0.018071" y="12.328736" z="0.337703"/>
<rotation angle="3.141593">
<axis x="0.000000" y="1.000000" z="0.000000"/>
</rotation>
</bone>
<bone id="9" name="LeftHip">
<position x="0.018071" y="12.328736" z="0.337703"/>
<rotation angle="3.141593">
<axis x="0.874147" y="-0.474570" z="-0.103201"/>
</rotation>
</bone>
<bone id="11" name="RightLeg">
<position x="-0.000000" y="1.968476" z="-0.000000"/>
<rotation angle="2.100223">
<axis x="-0.472563" y="0.829659" z="0.297239"/>
</rotation>
</bone>
<bone id="15" name="RightShoulder">
<position x="-0.000000" y="1.881597" z="-0.000000"/>
<rotation angle="0.413654">
<axis x="0.178409" y="0.000000" z="0.983956"/>
</rotation>
</bone>
<bone id="13" name="LeftShoulder">
<position x="-0.000000" y="1.881597" z="-0.000000"/>
<rotation angle="0.432727">
<axis x="0.169547" y="0.000000" z="-0.985522"/>
</rotation>
</bone>
<bone id="6" name="Back">
<position x="-0.000000" y="1.881597" z="-0.000000"/>
<rotation angle="0.050140">
<axis x="0.999550" y="0.000000" z="0.029989"/>
</rotation>
</bone>
<bone id="12" name="LeftLeg">
<position x="-0.000000" y="2.081492" z="-0.000000"/>
<rotation angle="2.049232">
<axis x="-0.479882" y="-0.811331" z="-0.333849"/>
</rotation>
</bone>
<bone id="17" name="RightAnkle">
<position x="0.000000" y="5.975729" z="-0.000000"/>
<rotation angle="1.311481">
<axis x="0.133203" y="0.990822" z="-0.022988"/>
</rotation>
</bone>
<bone id="0" name="RightArm">
<position x="0.000000" y="4.264647" z="0.000000"/>
<rotation angle="2.324231">
<axis x="-0.008142" y="0.039086" z="0.999203"/>
</rotation>
</bone>
<bone id="5" name="LeftArm">
<position x="-0.000001" y="4.301442" z="0.000000"/>
<rotation angle="2.310072">
<axis x="-0.008011" y="-0.038973" z="-0.999208"/>
</rotation>
</bone>
<bone id="18" name="Neck">
<position x="-0.000000" y="5.087479" z="-0.000000"/>
<rotation angle="0.051003">
<axis x="-0.982660" y="0.005384" z="0.185337"/>
</rotation>
</bone>
<bone id="2" name="LeftAnkle">
<position x="0.000000" y="5.929240" z="0.000000"/>
<rotation angle="1.556054">
<axis x="0.115952" y="-0.993096" z="0.017762"/>
</rotation>
</bone>
<bone id="7" name="RightFoot">
<position x="0.000000" y="5.335332" z="-0.000000"/>
<rotation angle="2.866626">
<axis x="-0.250014" y="0.964834" z="-0.081167"/>
</rotation>
</bone>
<bone id="4" name="RightWrist">
<position x="-0.000000" y="5.281136" z="0.000000"/>
<rotation angle="3.108084">
<axis x="-0.202590" y="0.972544" z="0.114521"/>
</rotation>
</bone>
<bone id="1" name="LeftWrist">
<position x="-0.000000" y="5.346117" z="-0.000000"/>
<rotation angle="3.029640">
<axis x="-0.199838" y="-0.972209" z="-0.121960"/>
</rotation>
</bone>
<bone id="10" name="LeftFoot">
<position x="0.000000" y="5.371225" z="-0.000000"/>
<rotation angle="2.717594">
<axis x="-0.223131" y="-0.970102" z="0.095468"/>
</rotation>
</bone>
<bone id="14" name="RightHand">
<position x="-0.000000" y="4.096985" z="0.000000"/>
<rotation angle="0.385538">
<axis x="0.234160" y="-0.965373" z="-0.114999"/>
</rotation>
</bone>
<bone id="16" name="LeftHand">
<position x="0.000000" y="4.132011" z="0.000000"/>
<rotation angle="0.308810">
<axis x="0.288363" y="0.949124" z="0.126531"/>
</rotation>
</bone>
</bones>
<bonehierarchy>
<boneparent bone="RightLeg" parent="RightHip" />
<boneparent bone="RightShoulder" parent="LowerBack" />
<boneparent bone="LeftShoulder" parent="LowerBack" />
<boneparent bone="Back" parent="LowerBack" />
<boneparent bone="LeftLeg" parent="LeftHip" />
<boneparent bone="RightAnkle" parent="RightLeg" />
<boneparent bone="RightArm" parent="RightShoulder" />
<boneparent bone="LeftArm" parent="LeftShoulder" />
<boneparent bone="Neck" parent="Back" />
<boneparent bone="LeftAnkle" parent="LeftLeg" />
<boneparent bone="RightFoot" parent="RightAnkle" />
<boneparent bone="RightWrist" parent="RightArm" />
<boneparent bone="LeftWrist" parent="LeftArm" />
<boneparent bone="LeftFoot" parent="LeftAnkle" />
<boneparent bone="RightHand" parent="RightWrist" />
<boneparent bone="LeftHand" parent="LeftWrist" />
</bonehierarchy>
</skeleton>


XML for model

<mesh>
<submeshes>
<submesh material="Material" usesharedvertices="false">
<faces count="226">
<face v1="0" v2="1" v3="2"/>
<face v1="3" v2="4" v3="5"/>
<face v1="6" v2="7" v3="8"/>
<face v1="9" v2="10" v3="11"/>
<face v1="12" v2="13" v3="14"/>
<face v1="15" v2="16" v3="17"/>
<face v1="18" v2="19" v3="20"/>
<face v1="21" v2="22" v3="23"/>
<face v1="24" v2="25" v3="26"/>
<face v1="27" v2="28" v3="29"/>
<face v1="30" v2="31" v3="32"/>
<face v1="33" v2="34" v3="35"/>
<face v1="36" v2="37" v3="38"/>
<face v1="39" v2="40" v3="41"/>
...
</faces>
<geometry vertexcount="646">
<vertexbuffer positions="true" normals="true" texture_coords="1" texture_coord_dimensions_0="2">
<vertex>
<position x="-2.913142" y="20.374107" z="-0.964990"/>
<normal x="-0.521091" y="0.654126" z="-0.548254"/>
<texcoord u="0.347413" v="0.082054"/>
</vertex>
<vertex>
<position x="-3.583804" y="19.777540" z="0.756352"/>
<normal x="-0.800524" y="0.402764" z="0.443782"/>
<texcoord u="0.414900" v="0.085874"/>
</vertex>
<vertex>
<position x="-2.933356" y="20.344515" z="1.095103"/>
<normal x="-0.534601" y="0.614500" z="0.580166"/>
<texcoord u="0.375958" v="0.041235"/>
</vertex>
<vertex>
<position x="-2.913142" y="20.374107" z="-0.964990"/>
<normal x="-0.521091" y="0.654126" z="-0.548254"/>
<texcoord u="0.347413" v="0.082054"/>
</vertex>
...
</vertexbuffer>
</geometry>
<boneassignments>
<vertexboneassignment vertexindex="0" boneindex="5" weight="1.000000"/>
<vertexboneassignment vertexindex="0" boneindex="6" weight="1.000000"/>
<vertexboneassignment vertexindex="0" boneindex="13" weight="1.000000"/>
<vertexboneassignment vertexindex="1" boneindex="5" weight="1.000000"/>
<vertexboneassignment vertexindex="1" boneindex="6" weight="1.000000"/>
<vertexboneassignment vertexindex="1" boneindex="13" weight="1.000000"/>
<vertexboneassignment vertexindex="2" boneindex="5" weight="1.000000"/>
<vertexboneassignment vertexindex="2" boneindex="6" weight="1.000000"/>
.....
<vertexboneassignment vertexindex="644" boneindex="18" weight="1.000000"/>
<vertexboneassignment vertexindex="645" boneindex="18" weight="1.000000"/>
</boneassignments>
</submesh>
</submeshes>
<skeletonlink name="Body-Armature.skeleton"/>
</mesh>

http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

raft

seems as you will go after ogre3d's skeleton format  :D why dont you have a look at ogre3d's code to have an idea how it's loaded and used.

just a suggestion ;)

cyberkilla

Might do that;)

I like this stuff. Nothing is easier to read than an xml file.

Those C++ struc's were not "my cup of tea";)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Egon, on your importer, you do not use any information about faces, or normals.

I do see a calcNormals, so you must be doing that yourself.
Do you think it will make much difference? I know that in blender, you sometimes have to manually flip some face normals, because you just dont work automatically.

Should I ignore them for now?


Oh, one more thing;)....
I have doubt with how the vertexes are stored.
I read they have three vertexes for the first triangle, and one for the rest.
I had better look into it more - it is, after all, the first time i've parsed a 3d model file;)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Loading from Ogre format:D
Okay, okay, it is messed up, but it looks very similar to the original;)
Ive just got the vertex offsets a little wrong:)
Im surprised it looks this good to be honest;)

http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

They do not seem to share vertexes.
Not that disabling this makes any difference to the way my mesh looks:P
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Quote from: "cyberkilla"Egon, on your importer, you do not use any information about faces, or normals.
calcNormals() creates the vertex normals. The face normals are automagically in jPCT. There's no way to set them from the outside. In my loaders i don't care about them (how should i when i can't set them) and i don't care about the vertex normals either an dlet them calculate by the engine. I've never really seen the sense in storing them in the file... :?:

cyberkilla

Yes, it seemed a bit strange to me also.
I wish I know show they stored these damned vertices;)
Cannot really find any proper documentation on the xml format.

In the MD2 format, the triangle vertice's seem to be grouped.
In Ogre XML they are a long list of verticis, and do not seem to work for me.

I have tried creating triangles "3 at a time", and also incrementing the vertex array, but similar results:)

I notice, in the Blender importer, it just called an "addVertex" function.
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

cyberkilla

Got it! It needed my to convert Quads into Triangles:D
Isnt triangles slower to render than quads though Egon?

http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG

EgonOlsen

Quote from: "cyberkilla"
Isnt triangles slower to render than quads though Egon?
Not really. OpenGL converts them to triangles anyway and so does almost every software renderer, mine included.