Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (652)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  SMD Animation  (Read 3479 times)
0 Members and 1 Guest are viewing this topic.
Offline tscott1213

Junior Newbie

Java games rock!

« Posted 2005-01-22 17:31:05 »


I am working on an importer for SMD files.  Right now I am getting some very odd transformations...

Specifically, in SMD files the vertices are stored in worldspace, therefore each vertex needs to be multiplied by the inverse of the initial bone position to put the vertices into bone space.   Does jME expect the vertices to be stored in bone space or world space?

Also, in SMD files each frame of the animation sequence gives the starting bone position in worldspace (not as an incremental transform from the starting skeletal position).  So, how is the localRefMatrix of a jointController used in setting the transforms for the model?

Please let me know if my questions are too garbled to follow!

Offline winkman

Senior Newbie

Java games !

« Reply #1 - Posted 2005-01-24 06:27:06 »

cep21 is the importer specialist for jme Wink, but i don't know if he reads this backup forum.
So if this is not answered in time i suggest waiting for the official forums to be back up and repost it there.
Offline cep21

Junior Devvie

Java games rock!

« Reply #2 - Posted 2005-01-24 12:46:16 »

SMD files?  What link are you using to find out about the format?

jME expects vertices to be stored in local space, and so does JointController.  The localRefMatrix again expects transforms to be relative to the joint parent.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline tscott1213

Junior Newbie

Java games rock!

« Reply #3 - Posted 2005-01-24 14:54:22 »

Hey guys, thanks for the help with this.

First, the file format is laid out in the appendix of the tutorial in the SDK for Half-life.  Also, I misspoke in my first post...the vertices are stored in local (model) space, not world space.

So, to make sure I understand....The vertices are stored in local space, so animation takes the following steps:

1) multiply the vertices by the inverse of the localRefMatrix to put them into bone space

2) multiple each vertex by the relative transform matrix of its joint

Offline cep21

Junior Devvie

Java games rock!

« Reply #4 - Posted 2005-01-24 15:41:17 »

That sounds right.  The JointController was made with the milkshape format in mind, so there may be a bit of tweaking to do.  With that said, it should still be workable for any Joint system that doesn't use multiple bones per vertex (which I don't believe halflife does).  if you run into any problems let me know.
Offline tscott1213

Junior Newbie

Java games rock!

« Reply #5 - Posted 2005-01-24 16:01:37 »

Here is the function in jointController that is throwing me...  Specifically, the bold line below where the jointmovements are set to the localRefMatrix?  Why is that necessary?  Are the animations supposed to be have joint positions relative to the localRefMatrix or just relative to their parent?

Thanks again, this is really helpful.

private void createJointTransforms(float changeAmnt) {
       PointInTime now = (PointInTime) movementInfo.get(curTimePoint);
       PointInTime then = (PointInTime) movementInfo.get(curTimePoint - 1);
       for (int index = 0; index < numJoints; index++) {
                int theParentIndex = parentIndex[index];


                unSyncbeginAngle.slerp(now.jointRotation[index], changeAmnt);
                unSyncbeginPos.interpolate(now.jointTranslation[index], changeAmnt);

                tempUnSyncd.set(unSyncbeginAngle, unSyncbeginPos);
                jointMovements[index].multLocal(tempUnSyncd, unSyncbeginPos);
                if (theParentIndex != -1) {
                      jointMovements[index].multLocal(tempUnSyncd, unSyncbeginPos);
Offline tscott1213

Junior Newbie

Java games rock!

« Reply #6 - Posted 2005-01-24 16:24:32 »

I think I found the answer to this....

The description of the Milkshape format indicates:

"...the key matrices animate the reference matrices, so you have to multiply them, to get the final local joint matrix..."

So, if the engine was built with this format in mind, I need to adjust the SMD key positions by the local ref matrix.

Thanks again, cep21 that was some invaluable insight.

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

SHC (24 views)
2015-08-01 03:58:20

Jesse (19 views)
2015-07-29 04:35:27

Riven (39 views)
2015-07-27 16:38:00

Riven (21 views)
2015-07-27 15:35:20

Riven (24 views)
2015-07-27 12:26:13

Riven (14 views)
2015-07-27 12:23:39

BurntPizza (35 views)
2015-07-25 00:14:37

BurntPizza (46 views)
2015-07-24 22:06:39

BurntPizza (28 views)
2015-07-24 06:06:53

NoxInc (36 views)
2015-07-22 22:16:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!