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 Discussion / A return to 3d Studio 3ds files

Author
Message
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 15th Apr 2003 23:41
This question relates to some of the 3ds models that come with DarkBasic. I'm specifically testing with cyborg, babe, amoung a few others. The object loading of 3ds files works for DB when the parent node is an object. However, if the parent node is a group it does not work correctly. So perhaps we could do a bit of a trade. If you follow the links below you can see what I've done to implement when parent nodes that are groups.

Can you explain to me the hierachy and what to do if the parent node is an object (or linked)?

With all the information at:
http://lib3ds.sourceforge.net
http://www.wotsit.org
http://www.gametutorials.com/Tutorials/opengl/OpenGL_Pg5.htm
http://www.gametutorials.com/forum/topic.asp?TOPIC_ID=5281

I can't find any information on the object track hierachy.

Does anyone know how the animation tracks should be applied to a child object when the parent is an object?

Applying parent to child was straightforward when the parent is a group and the child is an object because you just apply the position, rotation, and scale tracks from the group to the object.

But what do you do if the parent is an object and the child is an object? Does that even make sense (how could an object be a parent)? The only thing I can think of is that by having a parent object you get the effect that the objects are linked. In that case what should be done? Find a common vertex between the two and pivot on that?

Any ideas?
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Apr 2003 02:35
yes... export as a DirectX
don't waste you time with 3DS as it is a bugged format, and even more so when DarkBasic operates with it.

the best way to stop the headaches and problems is to export to a format which is fine and simplistic in its setup.
DirectX is one of these, or if you have DarkBasic Ehd i'd suggest using a memblock to import MD2's or such format as they work a treat.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 03:24 Edited at: 16th Apr 2003 03:28
I am using OpenGL. I have considered using the quake format, however this is an exercise in fun.

It might be a plagued format, but after you read the file you can structure it any way you want to. I've already been able to get the animation tracks working in most cases. This is the last case.

Last Case:
==========

How to apply animation tracks to children when the parent is an object???
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Apr 2003 04:25
well, it still really isnt so much a game format as a portable MAX file designed specifically so that other programs could import it.
you may find this post deleted as it doesn't bare anything for DarkBasic ... now if i remember right 3DS will apply the hierachy animation to the limbed (children) of an object mesh if you first set it up to be linked as a child and not just as a subobject.

Which means rather than attaching the object to the original one you use the Chainlink from the Child->Parent Limbs
else it treats the Child as if it is part of the parent mesh, and won't animate because it doesn't support mesh deformation.
i know its stupid thinking, but this is how Kinetix made the format.

i would suggest a Quake format for one of your first formats to import as they're pretty simplistic... Milkshape is another simple format which is good

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 09:24
Quote: "
now if i remember right 3DS will apply the hierachy animation to the limbed (children) of an object mesh if you first set it up to be linked as a child and not just as a subobject.
"


What is the difference between a "linked child" and a "subobject"?

This is a bit strange because in my case both parent and child nodes are objects. Where the parent object retains animation keys and the child also has animation keys. Which of the two (linked or subobject) could represent this case?

No more quake format suggestions. I already have md2 and md3 loaders available to me. This is just a special project.
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 09:27
DarkMatter has a 3ds loader built-in. Are you willing to share the source on how to load your own models?
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Apr 2003 10:33
the difference between a Child Limb and a SubObject, is that a SubObject is an attached object which becomes part of the object - whereas a Limb Object is a seperate object which is simply linked to the first one.
there is a big difference between the two

and DarkMatter uses DarkBasic 1.10, which has 3DS Importing builtin ... but that doesn't help you with your OpenGL project.
unless you want to use that to export to a format you know howto read.
also having the loaders available and developing them yourself are two different matters

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 11:10 Edited at: 16th Apr 2003 11:52
Let's examine the subobject case. Let me pull out some log from H-Cyborg-Move.3DS.

What you see after POSITION_TRACK_TAG is the number of position tracks for the object followed by the frame number of each track. This is simplier than looking at all the (x,y,z) coords.

Here is the animation hierachy for this snippet:
object 0: "Waist"
---> object 1: "L_Thigh"
--->--->object 2: "L_Leg_lowe"
--->--->--->object 3: "L_Foot"



I tried applying the animation keys from just 0 to 1, and "L_Thigh" appears in the wrong position.



3ds log snippet:



So let's examine your description a little more:
Quote: "the difference between a Child Limb and a SubObject, is that a SubObject is an attached object which becomes part of the object - whereas a Limb Object is a seperate object which is simply linked to the first one.
there is a big difference between the two "


"Which becomes part of the object", what does this mean? Do the verteces of the child object become part of the parent object? If so, what are the child animation keys for?
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 16th Apr 2003 12:31
this looks less like a problem getting the data and more a problem interpreting it... in which case you use the OFFSET of the Child in relivance to the OFFSet of the Parent

see what i can see happening is your taking the OFFSET of the Parent adding thee OFFSET of the limb and there ya go.

Cept it should be OFFSET of CHILD is the real offset, but you need to setup the Axis point which the whole limb is relavant to ... i've not worked with 3DS because it is the devils format
but i think the key lies within the original frame of reference, which you then setup the animation points ... because the movent will be based on

Parental Axis -> Offset from Axis -> Limb Axis in relation to Axis+Offset of Previous Limb/Parent -> Offset from Axis

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 21:04 Edited at: 16th Apr 2003 21:42
Quote: "this looks less like a problem getting the data and more a problem interpreting it... in which case you use the OFFSET of the Child in relivance to the OFFSet of the Parent"


I can parse every chunk available in the 3ds file. I don't have any problem accessing the data. You are right though, the problem is all in the interpretation.

Here is a sample of the data that I have available. I'll stick with vertex 0 and track 0 for node 0 and 1 for simplicity's sake.

Can you determine which sets of data your definitions are talking about? With any luck, the "L_Thigh" could be properly attached to the "Waist".



Note: The following logic was necessary to animate these models:
- http://tgraupmann.hypermart.net/models/sandharvestor2.3ds
- http://tgraupmann.hypermart.net/models/character.3ds.

To give you some insight.


For a basic model that doesn't have any grouping (when all the objects in the model have a parent of 65535), to display properly the logic is:

All OBJECT_VERTICES = POSITION_TRACK_TAG[0] + PIVOT


For the case that the parent is a group and the child is a group

CHILD POSITION_TRACK_TAG = PARENT POSITION_TRACK_TAG, when the parent has a parent

CHILD POSITION_TRACK_TAG = CHILD POSITION_TRACK_TAG + PARENT POSITION_TRACK_TAG, when the parent lacks a parent


For the case that the parent is a group and the child is a group

CHILD POSITION_TRACK_TAG = PARENT POSITION_TRACK_TAG


For the case that the parent is an object and the child is an object:

???? Don't know ????


Using the logic above the cyborg model looks like this:
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 16th Apr 2003 22:02
What modelling prog are you using, because I have a suspicion that this could be simpler than you think

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 16th Apr 2003 23:33
This is the H-Cyborg-Move.3DS model that comes with DarkBasic & DarkMatter.

And I wish this was simple. And it is, I just need to know what the logic should be. The coding will be straightforward at that point.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Apr 2003 03:47
i was just looking at the format source... you know that the Animation data is setup with Quaternions right?
it does make a difference when working them out (a good reason alot of people stick is MD2 rather than MD3 format)

i'll have to look a litter harder at the source see whats actually happening, but the data goes (roughly)

Frame Info (TCB, not sure why they called it that)
Next Quant Frame (Next pointer)
Axis/Pivot Point (Vector3)
Angle of Limb (Float)
Space Data (3x Quants)

Position track - Position (Float Vector)
Rotation track - Angle (Float Rad), Axis (Float)
Scale track - Size (3x Float)
FOV track - Angle (Float)
Roll track - Angle (Float)
Color track - (blank)
Morph track - Object name (String)
Hotspot track - Angle (Float)
Falloff track - Angle (Float)
Hidden track - (blank)

thats all 12 Floats of data accounted for i think
as i said i'll have to look more into this because i'm unaware on how they interact with each other ... but thats the basic setup.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 17th Apr 2003 06:32
Quote: "Frame Info (TCB, not sure why they called it that)"


Tension Continuity Bias Splines
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 17th Apr 2003 06:50
lol... well i couldn't find any info on what they were, just the source code - seemed to indicate that it was just the base information

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 17th Apr 2003 20:58 Edited at: 17th Apr 2003 21:00
Quote: "i was just looking at the format source... you know that the Animation data is setup with Quaternions right?"


Of course. I got by in my code without actually making a quaternion class. I may need to if it becomes necessary that the animation keys from a parent object needs to be applied to a child object.

What is this list of keywords? It sounds like you've been looking at http://lib3ds.sourceforge.net/tracks_c-source.html at http://lib3ds.sourceforge.net.

Frame Info (TCB) - This is available in the pos, rot, and scale tracks when a specific flag is set.
Next Quant Frame (Next pointer) - ???
- These two are in the rotation key #frame number (rotation in degrees, (x, y, z) Rotation Axis.
- Axis/Pivot Point (Vector3)
- Angle of Limb (Float)
Space Data (3x Quants) - ???

Position track - Position (Float Vector) - position animation keys
Rotation track - Angle (Float Rad), Axis (Float)
Scale track - Size (3x Float) - scale animation keys

Below, are these all part of the object animation keys? Or are these specific to camera, light, and spotlight animation keys?
FOV track - Angle (Float)
Roll track - Angle (Float)
Color track - (blank)
Morph track - Object name (String)
Hotspot track - Angle (Float)
Falloff track - Angle (Float)
Hidden track - (blank)
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 18th Apr 2003 20:35
Well how about you Darkbasic folks. Care to share a piece of your 3ds algorithm?
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 19th Apr 2003 23:19
Here is a better way to look at the problem:

The green sphere at the bottom is 0,0,0 for each object. All objects have a common 0,0,0 apparently?

The red spheres are each objects vertex[0] point.



The lower leg and foot are now moving together. Can you see why the upper leg and lower leg aren't pivoting together?
Danmatsuma
22
Years of Service
User Offline
Joined: 2nd Mar 2003
Location: Australia
Posted: 20th Apr 2003 06:01
Well one thing you can try, is to take this model into 3dsmax and reset the transforms to reorder the vertex points and rotation/translations. Also you could pull the links apart and relink to give the thing a hierachy you're happy with. Then reanimate. Or export as seperate objects and pull them all together elsewhere so you have full control over the way they are structured, creating your own file format in the process.. Where the 0 vertex is shouldn't matter, it's the rotation/translation stuff you're interested in if it's the animation that bothers you...

ZX Spectrum 48k Issue 3, Radio shack Tape drive, Rank arena 12" T.V. set.
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 30th Apr 2003 10:08
The solution *IS* for this model:

Read the position keys, but skip subtracting position[0] and the pivot from each vertex.

After the hierarchy is read, search for linked object hierarchies (any object that has a parent object).

Subtract position[0] and the pivot from each vertex for all objects the lack parents. Don't do this for linked objects or groups.

Call animate model recursively, so that the upper most parent is animated first working downward from parent to child until the node being displayed is animated.

The animated routine is a little different. If a linked object is detected then operate using the following conditions:
{
- If a node lacks a parent, translate by vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by vertex[last].
- If a node has a parent, and its parent has a parent, translate by vertex[1].
}

If the node is not a group, translate by position[x].

Scale by master scale.

Rotate by rotation[x].

If a linked object was detected then operate using the following conditions:
{
- If a node lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by -vertex[last].
- If a node has a parent, and its parent has a parent, translate by -vertex[1].
}

And that's all the is to it.

Now the strange part is that depending on the model the logic changes. To display the DarkBasic H-Hound model, it uses the following conditions
{
- If a node lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent lacks a parent, translate by -vertex[1].
- If a node has a parent, and its parent has a parent, translate by -vertex[1].
}

The only thing that makes these models different is the number of verteces in the nodes that this logic is applied to.

Would it be correct to switch between the two implementations of this logic depending on the number of verteces in each node?

Here is some info about the two models:
H-Cyborg
======
LF_Thigh: 39 verteces
LF_Calf: 44 verteces
LF_Foot: 38 verteces

H-Hound
=======
LF_Thigh: 28 verteces
LF_Calf: 24 verteces
LF_Foot: 12 verteces

So the number of verteces is different, is this cause enough to vary the animation algorithm???
LREM 8888
22
Years of Service
User Offline
Joined: 15th Mar 2003
Location: United Kingdom
Posted: 30th Apr 2003 21:53
This is getting confusing. If you actually get round it, give me a shout 'cuz i might be able to use this to my advantage...

An orange can't be a tomato but a tomato can be orange...
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 1st May 2003 21:35 Edited at: 1st May 2003 22:29
I've made serious progress lately. The 3ds loader I'm working on can support 50+ of the DarkBasic/DarkMatter models that use a linked object hierarchy.

To test the loader, I need the community to send me as many animated 3ds models as possible.

Will you help me? Every 'animated' model is appreciated.

Thanks,
Tim Graupmann
[email protected]
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 5th May 2003 22:49
Great News! http://www.gametutorials.com posted my 3ds animation source code. You know what this means. Beta tests are on. Test your models and send me bugs reports. Download the source here: http://www.gametutorials.com/download/CodeDump/3DSAnimation2_MOD.tar.gz.

-Tim Graupmann
[email protected]
http://tgraupmann.hypermart.net
tgraupmann
22
Years of Service
User Offline
Joined: 26th Feb 2003
Location: United States
Posted: 13th May 2003 00:49
2003-05-12 Ported to Linux/GLX.

Login to post a reply

Server time is: 2025-05-16 23:19:48
Your offset time is: 2025-05-16 23:19:48