Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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 3212 times)
0 Members and 1 Guest are viewing this topic.
Offline tscott1213

Junior Newbie




Java games rock!


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

Hey,

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!

Thanks
Todd
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 Duke




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

Thanks
Todd
Offline cep21

Junior Duke




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.set(then.jointRotation[index]);
                unSyncbeginPos.set(then.jointTranslation[index]);

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

                tempUnSyncd.set(unSyncbeginAngle, unSyncbeginPos);
                jointMovements[index].set(localRefMatrix[index]);
                jointMovements[index].multLocal(tempUnSyncd, unSyncbeginPos);
                if (theParentIndex != -1) {
                      tempUnSyncd.set(jointMovements[index]);
                      jointMovements[index].set(jointMovements[theParentIndex]);
                      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.

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (41 views)
2014-10-17 03:59:02

Norakomi (33 views)
2014-10-16 15:22:06

Norakomi (26 views)
2014-10-16 15:20:20

lcass (30 views)
2014-10-15 16:18:58

TehJavaDev (59 views)
2014-10-14 00:39:48

TehJavaDev (60 views)
2014-10-14 00:35:47

TehJavaDev (50 views)
2014-10-14 00:32:37

BurntPizza (66 views)
2014-10-11 23:24:42

BurntPizza (38 views)
2014-10-11 23:10:45

BurntPizza (80 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org 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‑gaming.org
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!