Jump to content
  • Advertisement
Sign in to follow this  
mad god

Reading objects from 3DS file

This topic is 3684 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi everybody! Did not know where to post this, so chose 'For Beginners' branch... Have a particular problem with subj. Will show it on an example: 1. I have a helmet model in 3DS file (made not by me). 2. It consists of 14 parts (objects in 3DS file). 3. Each object has a set of vertices and faces. 4. Generally each object (part) has its own LCS (local coordinate system). 5. Each object (part) has Mesh Information Block (MIB) in the Key Framer section. MIB for an object contains Object Pivot Point and a trio of Position, Rotation and Scale info for each Frame. 6. I consider the Frame 0 only. 7. Also MIB for an object may have a Father object and in my case all the objects have the 1st one as a Father. OK, The question IS: How am I to build a full model from those objects? What I do: For each object I take its vertices and faces and add them to the pool. In the end I have a several objects that do not comprise a helmet because they are positioned and rotated so they are'n form the helmet. I though - each object must be shifted and rotated so they all fit to form a nice helm. OK, let's do it: 1. For each object I took it's LCS which is 4 vectors (3 axes and origin) and made a matrix from them: D3DXVECTOR3 *pva1 = &pRawObject->sLCS.sAxis1; D3DXVECTOR3 *pva2 = &pRawObject->sLCS.sAxis2; D3DXVECTOR3 *pva3 = &pRawObject->sLCS.sAxis3; D3DXVECTOR3 *pvo = &pRawObject->sLCS.sOrigin; D3DXMATRIX mRotFinal( pva1->x, pva1->y, pva1->z, 0.0f, pva2->x, pva2->y, pva2->z, 0.0f, pva3->x, pva3->y, pva3->z, 0.0f, pvo->x, pvo->y, pvo->z, 1.0f); Then I applied this matrix to every vertex of the object: D3DXVec3TransformCoord(pv, pv, &mRotFinal); IT DID NOT WORK. 2. Well, I though that maybe MIBs in Key Framer block could help and used Rotation, Scaling and Positioning info from there. IT DID NOT WORK. 3. Ok, Many objects had a Father (see above). I applied father MIB for each object and.. IT DID NOT WORK, but was very close. 4. Ok, I applied father MIB for each object and the object's own MIB after that and... it became even worse... So, please tell me what should I do to get the correct positioning for each object in the 3DS scene. Thanks in advance!

Share this post


Link to post
Share on other sites
Advertisement
3DS itself should have a function for joining mesh objects. Why do you have to do it in your program? Unless you don't actually have a copy of 3DS.

Share this post


Link to post
Share on other sites
I read the file because I need to convert the model inside it to some other 3D format.
Nor that I have a copy of 3DS, whatever it is.

I read the most data OK, but the meshes aren't aligned as they should.
There is LCS for each mesh + some Rotation/Scaling/Position data in the keyframer block.

I tried to apply them in various combinations but to no avail.

Also there is a hierarchy of the objects in the keyframer block which could mean that I should apply parent transformations to its children... and maybe not.

So I'm confused here...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!