Sign in to follow this  
DarkEvilOne

3DS Loading, large gaps between objects

Recommended Posts

I'm really hoping someone here has a good knowledge of loading 3ds models. I'm writing a tool for converting 3ds models to a custom format and also allows the models to be viewed, rotated, scaled and translated in a window. So far i've got the D3D part up and running and 3ds loading works good on some models but i have an enemy model from the game i'm working on. It's made up of 8 3d objects which are animated. When i load it in my tool it displays the objects with large gaps between them. I noticed theres a chunk in the 3ds files as a sub chunk for each object and it holds the local co-ordinate system for the object. It contains a vector for the x axis, a vector for the y axis and a vector for the z axis (i think). It also contains a fourth vector for the origin. I'm guessing this chunk has something to do with the invalid positioning of the objects in my program. Can anyone tell me why the objects are being displayed with large gaps between them? And how can i fix the problem? Cheers :)

Share this post


Link to post
Share on other sites
Have you checked out the 3DS tutorials on this site and this site? They are in OpenGL, but loading the file should be pretty much the same. If there are some special translations you have to do, they'd probably be discussed there.

Share this post


Link to post
Share on other sites
Hey, thanks for the links but it didn't help. I saw 3 which loaded 3ds models and none of them could load this 3ds model correctly.

Cinema4D CE 6 and other 3d modelling programs which support 3ds can load it properly though.

I have managed to find some more information but i still can't work it out. I found out that the chunk in the 3ds file which i thought was the local co-ordinate system is actually a translation matrix, i think.

The chunk id is 0x4160 if that helps. I also noticed that the object vertex co-ordinates that i have read from the file are nothing like the vertex co-ordinates that Cinema4D shows me for the objects.

Share this post


Link to post
Share on other sites
I've been searching all over the 'net for 3ds viewers and code that can load and display 3ds models. So far the only programs i have used that can correctly load and display my 3ds model are Cinema4D CE 6 and some 3ds model viewer which i downloaded which wasn't open source. I have downloaded a ton of source code which can load 3ds models but none can load mine correctly.

Surely someone here has worked on a game and knows how to load 3ds models properly? Surely?!

If you would like i can send you a copy of the model so if you have wrote 3ds loading code you can check if it loads it properly for me and then maybe help me out?


Model loaded in Cinema4D..

# #
#####
## ##

Model loaded in any one of the many viewers i have downloaded
and my own viewer..

# #
## # ##
## ##

Basically the 3 parts in the bottom example are 3 different
objects in the 3ds file, in the top example they are positioned correctly but in the bottom example they have big gaps between them. This is exactly what i'm experiencing.


Also note that my 3ds viewer can load other models, i have loaded a cube model in it and another test model made for the game i'm working on (the test model i think was made up of a single object not several).

Share this post


Link to post
Share on other sites
I have written a loader and still use it. I haven't had a problem with any models yet with my loader. I'm not saying mine would load it correctly though because who knows, maybe there's some obscure block in there somewhere that that model uses. No idea.

If you want me to try that model out for you, let me know.

Share this post


Link to post
Share on other sites
hmm i just noticed your other post. i don't have chunk 4160 implemented. i have it defined as a constant but i've never had the need to implement it.

it definitely sounds like some kind of translation happening (or not happening in your case ;)


file format
that page seems to have info on 4160 as a translation block

Share this post


Link to post
Share on other sites
Hey thanks for the replies, i have emailed the model to you so you can see if your code can load it ok. I also saw that file format spec while searching for information on the 0x4160 chunk. The problem with that is i'm quite new to 3d graphics, being able to display a 3d model is a great step forward for me but i'm still a bit unsure with matrices, on that file format it says the chunk contains a 3x4 translation matrix, i already read this in from the file so could anyone tell me how i would go about using this matrix? (using D3D9 and D3DX9)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this