LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-18-2005, 02:45 AM   #1
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Rep: Reputation: 30
lib3ds -> bones


Hello,
I'm currently writing a game(Combat of Death), and I want to do some collision detection, I heard that it was a good idea to create boxes around a models(.3ds) bone.
But the problem is, I don't know how to get the information about the bones.
So my question is:
Is there some sorta variable, that holds all the information of a vertex, such as which bones it belongs to, and the skinweight for each bone?
If not, where can I find the variable the holds the bones, and the skinweights of the vertices?
Thanx in advance,
Hylke
 
Old 09-18-2005, 07:52 PM   #2
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
How are you loading and displaying your .3ds models? I don't know enough about the 3DS format to know if it stores the info you are looking for, but if it does, it kind of depends on what you use to load it.

If you wrote your own custom code to load a 3ds (kind of doubtful as you could probably find the answer to your own question the same place you found the details of the format to create your own loader), you should be able to figure out how to get that info. If you are using someone else's library, it really depends on if that library exposes that data. What little I know of the 3ds format, I would have to guess that you'd have to calculate the bounding boxes yourself.

Depending on how complex your models are, or how realistic you want the collision detection to be, it is sometimes easier and "good enough" to do simple spherical colision detection, or collision detection based on boxes around the whole model rather than individual bones. (I'm not even sure that the 3ds format stores bone data. But then, I've used it very little. I typically export models from Blender in my own custom formats using Python scripts.)
 
Old 09-22-2005, 01:40 AM   #3
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by deiussum
How are you loading and displaying your .3ds models? I don't know enough about the 3DS format to know if it stores the info you are looking for, but if it does, it kind of depends on what you use to load it.

If you wrote your own custom code to load a 3ds (kind of doubtful as you could probably find the answer to your own question the same place you found the details of the format to create your own loader), you should be able to figure out how to get that info. If you are using someone else's library, it really depends on if that library exposes that data. What little I know of the 3ds format, I would have to guess that you'd have to calculate the bounding boxes yourself.

Depending on how complex your models are, or how realistic you want the collision detection to be, it is sometimes easier and "good enough" to do simple spherical colision detection, or collision detection based on boxes around the whole model rather than individual bones. (I'm not even sure that the 3ds format stores bone data. But then, I've used it very little. I typically export models from Blender in my own custom formats using Python scripts.)
Hello deiussum,
Thank you for your reply.
I load my models using the library lib3ds(lib3ds.sourceforge.net), as you can see in my topic title :-) But the problem is that they have crappy documentation, and there isn't a lib3ds forum.
I don't think it's important for you know to know how I render my model, because it hasn't much to do with finding the information that I need, but if you desperatly want to see it you can take a look at: http://svn.gna.org/viewcvs/combatofd...04&view=markup
About wheter 3ds models support bones, i'm 100 % sure about that, because a couple of friens of me model in 3d studio max and they use bones in there models.

And in my case it isn't good enough to have just a simple box around my model, because my game also supports weapons.So when a player shoots at a model, I want to make sure that when the bullet collides to a box, it actually is a hit(the bullet collides with the model).
I hope this clears things up a bit
Hylke
 
Old 09-22-2005, 10:33 AM   #4
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
I understand that 3ds studio Max uses bones, but the .3ds format is an old format of theirs. The default extension for 3ds studio max files is .max I believe, and from what I understand, it is nearly impossible to load that format because it basically just gives you information for how 3ds created the model. You'd have to practically re-write 3ds studio max to load .max files. At least, that's the way it was years ago when I used 3ds Max. I've since switched to Blender.


Edit:
From what I remember and based on your code, the 3ds used frame-based animation as opposed to keeping bone type animation. (That is, it keeps a snapshot of all the vertex information for each frame of animation as opposed to keeping information based on bone movement.)

It looks like you have code to get vertices for each object node. Is your data appearing as a single object node, or do you get multiple objects (possibly based on how you used your bones before.) If multiple objects, you should be able to easily calculate a rough bounding box for each object node and use that.

Last edited by deiussum; 09-22-2005 at 10:48 AM.
 
Old 09-23-2005, 01:58 PM   #5
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Original Poster
Rep: Reputation: 30
Hello deiussum,
Again, thank you for your reply .
Quote:
It looks like you have code to get vertices for each object node.
Yup, that's correct.It does it by finding the mesh of the node, and then use the vertices of that mesh.
Quote:
Is your data appearing as a single object node, or do you get multiple objects (possibly based on how you used your bones before.) If multiple objects, you should be able to easily calculate a rough bounding box for each object node and use that.
I still don't exactly understand what nodes and meshes are.I just toke the example code, added and changed a few things and my 3ds class was born :-p.So I can't answere this question.

Last edited by hylke; 09-23-2005 at 02:03 PM.
 
Old 09-23-2005, 03:15 PM   #6
deiussum
Member
 
Registered: Aug 2003
Location: Santa Clara, CA
Distribution: Slackware
Posts: 895

Rep: Reputation: 32
If I understand it correctly, each node is a unit of information for various items in a scene. One such type of item would be a "mesh" which is basically your group of vertices that define an object. Other things might be something like lights, cameras, etc. I don't really know what all the 3ds format can store, so it kind of depends on that.

What I was curious about, is if all your mesh data is stored in a single node, or if it is broken up into multiple nodes. Say for instance if it is a human-like model, the arms, legs, body, etc. might all in their own distinct nodes. If the latter case, you should be able to use that vertex data to get a rough bounding box for each part of your model.
 
Old 09-24-2005, 03:29 AM   #7
hylke
Member
 
Registered: Apr 2004
Location: the Netherlands
Distribution: Ubuntu 7.04
Posts: 329

Original Poster
Rep: Reputation: 30
Quote:
Originally posted by deiussum
If I understand it correctly, each node is a unit of information for various items in a scene. One such type of item would be a "mesh" which is basically your group of vertices that define an object. Other things might be something like lights, cameras, etc. I don't really know what all the 3ds format can store, so it kind of depends on that.
Are you sure about the mesh thing?Because I get the mesh using my node's name.This way I would most probably only get one mesh(don't believe what my comments say, I wrote them and some of them might be bullshit, just like the mesh thing).

Quote:
What I was curious about, is if all your mesh data is stored in a single node, or if it is broken up into multiple nodes. Say for instance if it is a human-like model, the arms, legs, body, etc. might all in their own distinct nodes. If the latter case, you should be able to use that vertex data to get a rough bounding box for each part of your model.
Oh, grouping vertices using nodes.That's a brilliant idea :-p.
My current code now creates a box for each node, so also for there node childeren.
But i'm not sure wheter that's a good idea, because I can imagine that if you have in example an arm, that it will have also hands(although an arm and a hand don't belong together, you probably know what I mean)and they require different material settings, thus it needs a child node(because a node holds the material properties).
And is there some sorta mothernode, a node were all other nodes are childeren from?
Thanx in advance,
Hylke

Last edited by hylke; 09-24-2005 at 03:33 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cygwin -> compiling lib3ds hylke General 0 06-21-2005 02:02 AM
What do I lose for a bare bones install? mhelliwell Linux - General 3 02-27-2005 07:14 PM
Linux vs. Windoze down to the bones (for science fair) TheOneAndOnlySM Linux - General 34 08-31-2003 04:54 PM
Bare bones install with KDE3 and internet browser? erp Linux - Newbie 3 08-11-2003 02:58 AM
Bare-Bones Install barddzen Linux - Newbie 1 12-16-2002 10:06 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration