PDA

View Full Version : 3DS ... How to attach Skeleton to Body using this file format ???



jubei_GL
09-16-2002, 07:38 PM
Ok .. My problem is .. I have 3D model made in Max . Its animated using Biped (skeleton) and footsteps .. When I export this model to 3DS i get two parts : #1 3D model, #2 Skeleton animation .. Now everything is read, but how am I supposed to attach skeleton animation to the model ..

I looked at all possible solutions, and came to conlusion that there MUST be a chunk in 3DS file that stores which vertices of 3D model are affected by EACH BONE of the SKELETON .. If you are familiar with 3DS, just think the way they tell you how to draw FACES (Polygons) of the 3D model .. You have array of faces [ex] FACE[0] , and each face holds 3 values which are 3 vertices that form this face ..

Before I was thinking that Vertex array or Face array is created in Hierarchy type, similar to Hierarchy used in Keyframe animation .. But this can't be since there can be more than 1 bone in the same body part, thus who's to decide which bone affects which vertex .......

When I was loading the Model and Keyframe data, I was looking for the chunk that might hold that information, but so far I was unable to find it ....

I know it has to be there, unless they screwed it up , and came up with different way to assing it ... However why would they use different way, since we already decide which Vertex is used by which bone when we adjust Envelopes under Physique .........

tfpsly
09-16-2002, 10:34 PM
Your mesh is made of several objects. Each object itself is not animated/altered in any way.
The animation is stored in a tree, each object being animated according to his "father": each object has a translation, a rotation and a scaling according to his father position.

Have a look at Clax, http://www.geocities.com/SiliconValley/Bay/6525/
to fully understand how that's working.

You're interested into these chunks:
#define _3DS_ANIM 0xb000
#define _3DS_ANIM_HDR 0xb00a
#define _3DS_ANIM_FSEG 0xb008
#define _3DS_ANIM_TIME 0xb009
#define _3DS_DUMMYNAME 0xb011
#define _3DS_ANIM_OBJ 0xb002
#define _3DS_ANIM_CAMERA 0xb003
#define _3DS_ANIM_CAMERA_TRGT 0xb004
#define _3DS_ANIM_LIGTH 0xb005
#define _3DS_ANIM_SPOT_TRGT 0xb006
#define _3DS_ANIM_SPOT 0xb007
#define _3DS_ANIM_NODE 0xb030
#define _3DS_ANIM_NODE_HDR 0xb010
#define _3DS_ANIM_POS 0xb020
#define _3DS_ANIM_FOV_TRACK 0xb023
#define _3DS_ANIM_ROLL_TRACK 0xb024
#define _3DS_ANIM_COL_TRACK 0xb025
#define _3DS_ANIM_MORPH_TRACK 0xb026
#define _3DS_ANIM_HIDE 0xb029
#define _3DS_ANIM_ROT 0xb021
#define _3DS_ANIM_SCL 0xb022
#define _3DS_ANIM_PIVOT 0xb013

[This message has been edited by tfpsly (edited 09-17-2002).]

jubei_GL
09-17-2002, 04:06 AM
no no no ..

I know how animation works .. I even traced the Hierarchy level of it ...

My problem is with attaching that animation to the FINAL 3D mesh .. You know how Biped (skeleton) is attached to 3D model right ?

When I read the animation I read arrays of data for particular BONE of that skeleton, which hold its Position through each frame of animation , + its rotation and scaling ... This everything is read by me and stored ..

My problems is after that HOW am I supposed to decide which vertex of the 3D model is affected by which BONE ??? In my case there are Skeleton Bones that are VERY close to eachother .. I can't just assume they will move in the same way, couse they WON"T .....

I searched all those chunks that store info about the Keyframe, but none of them store the Info that I seek ...

Just to make clear, I don't ANIMATE the object (3D mesh) manually frame by frame, by moving parts of the object from frame A to frame B ... I use SKELETON (Biped) and footsteps to animate the model .. My TOTAL animation is read and stored by me .. Only thing left is to attach it to the 3D model.

Further, I animate the 3D modal in Max4.0 and then Export it to 3DS. When I load the 3DS file again using IMPORT button, I get 2 things.. #1 is the 3D model and #2 is Skeleton animation .. They are NOT (NOT!) attached to eachother when I load the 3DS, so when I hit the PLAY button, ONLY skeleton moves, 3D mesh does NOTHING, as it should, since they are not attached to eachoter... However 3DS format still must store the Information of which VERTEX of the 3D mesh model is affected by which BONE !!!!

[This message has been edited by jubei_GL (edited 09-17-2002).]

ToolTech
09-17-2002, 04:36 AM
You are right. It's not part of the .3ds format. You must use another format or use your own file exporter etc. to get this data....

tfpsly
09-17-2002, 04:41 AM
I've never seen bones in the 3ds format, so I can't tell much more...
Are you sure the .3ds file format does store sqkeleton animation?
From what you're telling at the end, it does seem that the skeleton is stored in a hacked way because the .3ds format does not handle it.

V-man
09-17-2002, 04:56 AM
I have seen keyframe for the 3ds format. What exactly is that suppose to mean. Snapshots of the animation?

V-man

ToolTech
09-17-2002, 05:01 AM
The keyframe animation only stores the relative quarternion relationship between hierachical nodes. The skinning is not stored in the .3ds file format. You need to use names with certain naming rules to use skinning with .3ds. Have a look at Gizmo3D at www.tooltech-software.com (http://www.tooltech-software.com) wich solves all these issues. You can find info in the scene graph about how it works...

The best solution is to use the .ase format or your own format...

jubei_GL
09-17-2002, 05:35 AM
well that's a BUMMER !!!!!!!!!

Now I know why they no longer use 3DS format .. It BLOWS

Same thing happened to me when it came down to read information for each bone of the Skeleton .. I had no way of finding out how many bones there are, before reading them .. I had to create Linked list, to store the information for each bone, and when there was another bone to be read, I would just attach NEW NODE to the list ....

But thie LACK of Bone to Vertex Relation INFO TOTALLY SUX !!!! Im 99% done with 3DS, animation loaded, 3D mesh loaded, but can't connect them . AGGGGHJHHHHHHHHH 2 weeks spent for NOTHING! Ahh maybe not, I had a BLAST writing the code, and debuging that BABY, but Im pissed about this situation ...

I will try to do something with the Hierarchy, or I will try to import the Bone/Vertex relation from a different File...

I guess 3DS ain't the best way to load complex animations into OpenGL.

OK I put some pictures in my website. First models shows my 3D model under Physique Modifier.. It shows enelopes, and how you can assign Vertices to each Bone .. The other 2 show 3D model in 3DS form ... You have 3D mesh and objects that represent Skeleton Animation ...

http://www.angelfire.com/droid/jubei/



[This message has been edited by jubei_GL (edited 09-17-2002).]

Dodger
09-17-2002, 12:49 PM
Careful with ASE, even. Although bones and keyframe animation is exported to ASE, vertex weights and bone-vertex-associations are not (or at least I couldn't figure out how, if anyone knows, please let me know!).

V-man
09-18-2002, 11:30 AM
Thanks dodger, I was about to ask about it.

I might make a ase exporter, but wont be for a while. 3ds is very popular but not modern. I asked a couple of 3ds lib writers about support for multitexture, color per vertex and normals but didnt get an answer. It's very bizarre that there is no normals.

V-man

jubei_GL
09-18-2002, 11:55 AM
you can always compute your own normals when you read or after you read faces.

ToolTech
09-18-2002, 11:16 PM
Just remeber to use the vertex group info so you don't create uniform normals for the whole model. In some cases the vertex group is just a single group. In that case you need to use a formula when the faces are aligned within lets say 15 degrees etc.

It is hard to get the model to look like the .3ds model in the studio..

You can do multitexture. e.g. use ligh maps and use trasparency maps as well. Look at the map types supported in the .3ds file format.

To get speedy normal creattion use hash tables with hash values computed from face sides.

Try the Gizmo3D .3ds loader and if you have further questions I can show you how I did in the Gizmo3D loader. It has almost all info in the .3ds file used..

V-man
09-19-2002, 05:52 AM
>>>You can do multitexture. e.g. use ligh maps and use trasparency maps as well. Look at the map types supported in the .3ds file format.<<<


No, nothing like that was written in the spec I've seen. I have seen the same spec offered by many web sites, actually, and only one of them had some minor formatting diffrence. Maybe somehow made some discoveries about the format?

So you are saying that it is possible to have multiple tex coordinates in a 3ds file?

I'll check your thing when I have time.

V-man

ioquan
09-19-2002, 09:59 AM
You might want to look into MilkShape 3D. It supports many common model file formats for both import and export, including 3DS, Half-Life, Quake 1,2,3, Unreal, and many more. Milkshape also has an SDK so you can write your own import and export routines.

jubei_GL
09-19-2002, 10:57 AM
well. thx for input guys ..

Im going to play with Max SDK for a little .. I just found Example Plugin for Max Exporter, that came with the max, and will try to tweak it a little bit, if possible, and who knows, maybe even enable storage of Skeleton Information ith 3DS ..... it looks like there is a lot of code to it, don't know If Im up to the task .. hehe ... Will post soon with updtates, good OR bad ...

V-man
09-19-2002, 05:15 PM
Tooltech, I checked the zip, but didn't skim through it.

It was dll, lib and h. There's no document or source for your project?

I would prefer to see the code actually.

V-man

t0y
09-19-2002, 06:06 PM
There's:

Texture map1
Texture map2
Opacity map
Bump map
Specular map
Shininess map
Self illumination map
and Reflection map.

All of these can have a mask defined. Also, all of them can have individual texture matrix configurations.


But only one set of tex coordinates.... http://www.opengl.org/discussion_boards/ubb/frown.gif