3DS Pivot point

hi

Can anyone tell me, what the pivot point does in a 3DS file’s Keyframer data? Is it a simple offset to be added to the translation track’s translations? Or do I have to add it somewhere else(, too)?

I’m trying to fix out 3DS loader and have problems understanding this item.

Marvin

One more question: In some of the existing loaders, translation values are read like this:
x = readFloat();
z = ReadFlaot();
y = -readFloat();

Is this just to convert from z-up to y-up? Or is there another reason? I modify the mesh-matrix to convert the whole model from z-up to y-up. Isn’t this sufficient?

Marvin

[quote]Can anyone tell me, what the pivot point does in a 3DS file’s Keyframer data? Is it a simple offset to be added to the translation track’s translations? Or do I have to add it somewhere else(, too)?
[/quote]
the pivot point is exacly a pivot point :), rotation must be done around this point, it is different than the local axis origin. so before performing rotation you must substract it. To get full mesh information, it should be read even when not using the KeyFrame and it should be used in your scenegraph as the pivot point of the object.

to setup an object :
translate object by -pivot
apply rotation
tranlate obect to its world pos

[quote]One more question: In some of the existing loaders, translation values are read like this:
x = readFloat();
z = ReadFlaot();
y = -readFloat();

Is this just to convert from z-up to y-up? Or is there another reason? I modify the mesh-matrix to convert the whole model from z-up to y-up. Isn’t this sufficient?
[/quote]
In 3DS : Z is going UP, Y is going forward, and X is going to the right, depending on wich axis you use you have to convert values.

seems that in your sample :
x=x
z=y
y=-z

looks strange as for a common left hand (x right,z forward,y up) it should be read :
x=x
z=y
y=z

Thanks for the great info. I actuall never knew, what exactly a pivot point is. I couldn’t fint any info about it.

In a common left handed coordiante system with y-up, -z points foreward, doesn’t it?

From the 3DS file I get a pivot point (pivot), a translation (t), a rotation ® and a scale (s). Is the following transformation correct?

scale by (s)
translate by -(pivot)
rotate by ®
translate by (t)
transform by world transformation (coming from the scenegraph)

Since I modify the mesh matrix to convert from z-up to y-up, there shouldn’t be any swapping of the translation values necessary. Is this correct?

Marvin

This 3DS talk is relevant to my interests.
Does anyone have any good 3DS tutes/FAQs/links/examples/source?

Does anyone have a sample 3DS model, that has full animations? The only ones I could find in the internet just have single-frame-animations, which means no animations, just one-time-transformations to be applied and therefore cannot be used for actual animation tests.

The best documentation, I could find is this: http://www.jalix.org/ressources/graphics/3DS/_unofficials/3ds-info.txt
But it is still quite incomplete in terms of chunk-descriptions. Unfortunately there doesn’t seem to be any document, that really explains, what is expected in what order and what the read values actually mean.

Marvin

I finally got it ;D. It is really odd!

This is, how it goes:

  • You first need to transform each vertex-coordinate of a mesh by the inverse-mesh-matrix (unique to each object).
  • Then you should offset each vertex-coordinate of a mesh by the negative pivot point.
    Even if the pivot point is part of the key-framer node, it is not completely part of the hierarchy! The pivot point always only transforms the mesh, but not the keyframer-node’s children.
  • Then everything goes as expected. You need to read the translation-, rotation- and scale-keyframes and multiply them in that order to get the full transform of a keyframe.
  • Then you need to build the hierarchy. This is done by identifying the parent (father) of a keyframe-node and attach the current node to the father. A father-id of -1 means root. Oddly the -1 is read as 0xFFFF!

Some models don’t have keyframer data. Then you have to directly attach the objects to the model (without any transforms and without any pivots), but you still need to transform the vertex-coordinates by the inverse mesh matrix.

Some other models may have keyframer data, but don’t animate some parts of the model. I haven’t found any models, that are like that, but there’s no reason, why there shouldn’t be such models.

I hope, this is helpful to some people. It caused me nightmares and costed me days to find this out almost completely without documentation, that actually tells you something in detail. Please don’t hesitate to ask, if I missed anything to explain.

Marvin