View topic - C++ MD5 implementation



All times are UTC + 1 hour


Post new topic Reply to topic  [ 20 posts ] 
Author Message
 Post subject: C++ MD5 implementation
PostPosted: 07 Mar 2009, 14:07 
User avatar

Joined: 16 May 2007, 17:33
Hello,

I'm working on a MD5 (currently md5mesh only) implementation for spring.

I have some problems to figure out what is what in S3DModel (3DModel.h) and how the "UnitModel-interface" works.
Mainly it is due the lag of comments/documentation (yeah again docs and I know less docs/comments = better programmer) for 3DModel.h and related files...

Due gits log jk wrote this. Jk could you please add more comments or explain me how I can implement my MD5 data structure to the abstract S3DModel?


Top
 Offline Profile  
 
PostPosted: 07 Mar 2009, 15:40 
Spring Developer

Joined: 08 Oct 2006, 15:58
S3DModel is the common base for 3DO and S3O models. There are no "3DOModel" or "S3OModel" structures because both formats are piece hierarchies (trees), instead the specialization is present in S3DOPiece and SS3OPiece which extend S3DModelPiece (hence the S3DModelPiece* rootobject). MD5 models, being flat lists of meshes that have no parent / child relationships, do not fit in that design so well, so you'll probably want to insert some higher layer of abstraction above it. (For my own implementation I didn't care to do that part.)


Top
 Offline Profile  
 
PostPosted: 07 Mar 2009, 16:11 
User avatar

Joined: 16 May 2007, 17:33
Oh did not know that you implemented MD5 in spring, too.
Is it written in Lua or C++?


Top
 Offline Profile  
 
PostPosted: 07 Mar 2009, 19:46 
Moderator

Joined: 22 Aug 2006, 15:19
for the record, RTCW used piece trees IIRC, and it was using md3, so it's not unexplored ground.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 12:01 
User avatar

Joined: 16 May 2007, 17:33
Well so we need a general abstraction level which could be used for flat based model formats like MD5 and for trees/hierarchies like 3DO, S3O...
Or two abstraction levels.... :roll:

Hm, need to study some 3D stuff, thought.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 12:35 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
I don't think we need a new abstraction, AFAIK md5 uses bones which are nothing else than pieces.

But animations need a new system and I don't think adding those is possible with cob. So someone has to code a lua animation system to replace cob. :(


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 12:53 
User avatar

Joined: 16 May 2007, 17:33
jK wrote:
I don't think we need a new abstraction, AFAIK md5 uses bones which are nothing else than pieces.

Hm, I don't understand the construction of "struct S3DModelPiece", atm.

My vector math is a bit rusty (basically general math, too :cry: ) and this also does not help.
I need to relearn it anyway so I will do it next week at work :mrgreen: .

Could someone give me a list of thinks which I need to know like:
- Vector
- Quaternions


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 13:07 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
S3DModelPiece doesn't do any math, it just contains the piece information (max/min dims, offset to parent piece, is empty piece) loaded from the file.
The math is done in LocalModelPiece. It is a local instance of the ModelPiece and contains per unit information of the piece instance (position, rotation, hidden, LODs).
Also it doesn't use Quaternions, it uses simple radians for the rotations.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 13:48 
User avatar

Joined: 16 May 2007, 17:33
jK wrote:
S3DModelPiece doesn't do any math, it just contains the piece information (max/min dims, offset to parent piece, is empty piece) loaded from the file.
The math is done in LocalModelPiece. It is a local instance of the ModelPiece and contains per unit information of the piece instance (position, rotation, hidden, LODs).
Also it doesn't use Quaternions, it uses simple radians for the rotations.

I know that S3DModel(Piece) contains only informations and don't do any math.
But I need math to turn md5 flat structure to a tree structure.
MD5 uses quaternions.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 14:18 
Spring Developer

Joined: 08 Oct 2006, 15:58
jK wrote:
I don't think we need a new abstraction, AFAIK md5 uses bones which are nothing else than pieces.


Joints actually, the bones are implicit. But each joint only knows its parent joint (not vice versa), so the transformations cannot be applied the same way as in 3DO/S3O.

jK wrote:
But animations need a new system and I don't think adding those is possible with cob. So someone has to code a lua animation system to replace cob. :(


Indeed, animation control is the big sticking point. Making a player for them isn't so difficult (mine is mostly done, IIRC I had only blending left to add), but feeding it commands from the simulation would take more effort.


Agon: it's in C++, with a small quaternion library (which I'll integrate into Spring if you plan on continuing your work).


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 14:24 
User avatar

Joined: 16 May 2007, 17:33
Kloot wrote:
...
Agon: it's in C++, with a small quaternion library (which I'll integrate into Spring if you plan on continuing your work).

If you already started work on MD5 for spring in C++ I don't need to add another implementation. It would be more efficient to help you or continue your work.
How much did you finished?
Yes, I plan to continue the work, the library would help.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2009, 17:06 
Moderator

Joined: 22 Aug 2006, 15:19
Kloot wrote:
Indeed, animation control is the big sticking point. Making a player for them isn't so difficult (mine is mostly done, IIRC I had only blending left to add), but feeding it commands from the simulation would take more effort.
If I understand correctly, from what little I know a call lua_*-like hack from COB could work... e.g. call md5anim_do_stuff()


Top
 Offline Profile  
 
PostPosted: 19 Mar 2009, 20:52 
Moderator

Joined: 22 Aug 2006, 15:19
http://fabiensanglard.net/bumpMapping/index.php

sources include an md5 c++ class.


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 02:18 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
instead of such island solutions i would support this:

http://assimp.sourceforge.net/


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 02:24 
Moderator

Joined: 22 Aug 2006, 15:19
oooh shiny.

that link was posted on reddit, so i only copypasted it here. never doubted there are better options out there ^^ edit: it's BSD...


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 02:38 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
License page says:
"ASSIMP is released as Open Source under the terms of a 3-clause BSD license."

the "3-clause BSD license" is a modified BSD license, which is GPL compatible ^-^


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 02:47 
Moderator

Joined: 22 Aug 2006, 15:19
tried to google it and it wasn't so clear to me, but if it really is compatible, then "^_^" indeed 8)

anyway, how's Kloot's work on md5? did it go out of lua stage?


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 02:59 
Redacted
User avatar

Joined: 08 Jan 2007, 06:13
Location: Don't be silly. If there's no machine heaven, where do all the toasters go?
BSD is the one that lets you do anything, even pull it into closed source...


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 03:30 
Spring Developer
User avatar

Joined: 28 Jun 2007, 06:30
still the original BSD license is GPL incompatible ;)


Top
 Offline Profile  
 
PostPosted: 20 Mar 2009, 04:05 
Redacted
User avatar

Joined: 08 Jan 2007, 06:13
Location: Don't be silly. If there's no machine heaven, where do all the toasters go?
But how common is it?


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 20 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.